mdx-mermaid
Affected
- introduced
0, fixed1.3.0(semver)
Fixed versions
1.3.0
Fix
- Fixed version
1.3.0npm install [email protected]
Advisory
Also known as: CVE-2022-36036
Improper Control of Generation of Code ('Code Injection') in mdx-mermaid
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
```mermaid
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
```
The same block but with the exploit added
```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
Low Basis: The source's own band: LOW
0, fixed 1.3.0 (semver)1.3.0
1.3.0npm install [email protected]2.0.0-rc1, fixed 2.0.0-rc2 (semver)2.0.0-rc2
2.0.0-rc2npm install [email protected]Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0