{"id":"CVE-2022-36036","aliases":["CVE-2022-36036","GHSA-rvgm-35jw-q628"],"related":[],"kind":"vulnerability","state":"published","title":"Improper Control of Generation of Code ('Code Injection') in mdx-mermaid","summary":"mdx-mermaid provides plug and play access to Mermaid in MDX. There is a potential for an arbitrary javascript injection in versions less than 1.3.0 and 2.0.0-rc1. Modify any mermaid code blocks with arbitrary code and it will execute when the component is loaded by MDXjs. This vulnerability was patched in version(s) 1.3.0 and 2.0.0-rc2. There are currently no known workarounds.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"mdx-mermaid provides plug and play access to Mermaid in MDX. There is a potential for an arbitrary javascript injection in versions less than 1.3.0 and 2.0.0-rc1. Modify any mermaid code blocks with arbitrary code and it will execute when the component is loaded by MDXjs. This vulnerability was patched in version(s) 1.3.0 and 2.0.0-rc2. There are currently no known workarounds.","source":"cvelist"},{"lang":"en","text":"### 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","format":"markdown","source":"ghsa"},{"lang":"es","text":"mdx-mermaid proporciona acceso plug and play a Mermaid en MDX. Se presenta la posibilidad de una inyección arbitraria de javascript en versiones inferiores a 1.3.0 y 2.0.0-rc1. Modificar cualquier bloque de código de Mermaid con código arbitrario y será ejecutado cuando el componente sea cargado por MDXjs. Esta vulnerabilidad fue parcheada en versiones 1.3.0 y 2.0.0-rc2. Actualmente no se presentan mitigaciones conocidas","source":"nvd"}],"published":"2022-08-29T17:20:10.000Z","modified":"2026-06-17T04:52:47.327Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:N","score":3.6,"rating":"LOW"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:N","score":3.6,"rating":"LOW"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:N","score":3.6,"rating":"LOW"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"}],"cwes":["CWE-94"],"affected":[{"ranges":[{"version":"< 1.3.0","status":"affected"},{"version":"= 2.0.0-rc1","status":"affected"}],"vendor":"sjwall","product":"mdx-mermaid","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"1.3.0"}],"ecosystem":"npm","package":"mdx-mermaid","purl":"pkg:npm/mdx-mermaid","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"2.0.0-rc1","status":"affected","fixed":"2.0.0-rc2"}],"ecosystem":"npm","package":"mdx-mermaid","purl":"pkg:npm/mdx-mermaid","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"0.0.1","fixed":"1.3.0"},{"status":"affected","version":"2.0.0"}],"vendor":"mdx-mermaid_project","product":"mdx-mermaid","cpe":"cpe:2.3:a:mdx-mermaid_project:mdx-mermaid:*:*:*:*:*:node.js:*:*","source":"nvd"}],"references":[{"url":"https://github.com/sjwall/mdx-mermaid/security/advisories/GHSA-rvgm-35jw-q628","tags":["exploit","third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/sjwall/mdx-mermaid/commit/f2b99386660fd13316823529c3f1314ebbcdfd2a","tags":["patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-36036","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/sjwall/mdx-mermaid","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2025-04-22T15:44:51.517Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2022-36036","url":"https://www.cve.org/CVERecord?id=CVE-2022-36036","licence":"CVE Terms of Use","modified":"2025-04-22T17:41:03.862Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-rvgm-35jw-q628","url":"https://github.com/advisories/GHSA-rvgm-35jw-q628","licence":"CC-BY-4.0","modified":"2023-11-08T04:09:58.603Z"},{"source":"nvd","name":"NVD","id":"CVE-2022-36036","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-36036","licence":"Public domain","modified":"2026-06-17T04:52:47.327Z"}],"updatedAt":"2026-11-25T22:58:14.542Z","epss":{"score":0.00398,"percentile":0.36188,"date":"2026-12-01T12:00:22.000Z"}}