CVE-2022-36036
Improper Control of Generation of Code ('Code Injection') in mdx-mermaid
mdx-mermaid provides plug and play access to Mermaid in MDX. There is a potential for an arbitrary javascript injection in versions less than 1.3.0 and 2.0.0-rc1. Modify any mermaid code blocks with arbitrary code and it will execute when the component is loaded by MDXjs. This vulnerability was patched in version(s) 1.3.0 and 2.0.0-rc2. There are currently no known workarounds.
Attack profile
How easy it is to exploit
- Attack vector
- Local
- Complexity
- High
- Privileges needed
- Low
- User interaction
- None
What an attacker can affect
- Confidentiality
- Low
- Integrity
- Low
- Availability
- None
Exploit likelihood
What each source reports
CVE List Score used
3.6
Improper Control of Generation of Code ('Code Injection') in mdx-mermaid
mdx-mermaid provides plug and play access to Mermaid in MDX. There is a potential for an arbitrary javascript injection in versions less than 1.3.0 and 2.0.0-rc1. Modify any mermaid code blocks with arbitrary code and it will execute when the component is loaded by MDXjs. This vulnerability was patched in version(s) 1.3.0 and 2.0.0-rc2. There are currently no known workarounds.
- Record
CVE-2022-36036- CVSS 3.1
- 3.6 Low
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:N - Weakness
- CWE-94
- Updated
- 2026-11-02
EUVDEUVD-2022-6624
3.6
mdx-mermaid provides plug and play access to Mermaid in MDX. There is a potential for an arbitrary javascript injection in versions less than 1.3.0 and 2.0.0-rc1. Modify any mermaid code blocks with arbitrary code and it will execute when the component is loaded by MDXjs. This vulnerability was patched in version(s) 1.3.0 and 2.0.0-rc2. There are currently no known workarounds.
- Record
EUVD-2022-6624- CVSS 3.1
- 3.6 Low
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:N - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-rvgm-35jw-q628
3.6
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
- Record
GHSA-rvgm-35jw-q628- CVSS 3.1
- 3.6 Low
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:N - Weakness
- CWE-94
- Updated
- 2026-11-02
NVD
3.6
mdx-mermaid provides plug and play access to Mermaid in MDX. There is a potential for an arbitrary javascript injection in versions less than 1.3.0 and 2.0.0-rc1. Modify any mermaid code blocks with arbitrary code and it will execute when the component is loaded by MDXjs. This vulnerability was patched in version(s) 1.3.0 and 2.0.0-rc2. There are currently no known workarounds.
- Record
CVE-2022-36036- CVSS 3.1
- 3.6 Low
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:N - CVSS 3.1
- 7.8 High
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H - Weakness
- CWE-94
- Updated
- 2026-11-02
OSV
3.6
Improper Control of Generation of Code ('Code Injection') in mdx-mermaid
mdx-mermaid provides plug and play access to Mermaid in MDX. There is a potential for an arbitrary javascript injection in versions less than 1.3.0 and 2.0.0-rc1. Modify any mermaid code blocks with arbitrary code and it will execute when the component is loaded by MDXjs. This vulnerability was patched in version(s) 1.3.0 and 2.0.0-rc2. There are currently no known workarounds.
- Record
CVE-2022-36036- CVSS 3.1
- 3.6 Low
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:N - Weakness
- CWE-94
- Updated
- 2026-11-02
OSVGHSA-rvgm-35jw-q628
3.6
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
- Record
GHSA-rvgm-35jw-q628- CVSS 3.1
- 3.6 Low
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:N - Weakness
- CWE-94
- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
mdx-mermaidnpm |
before 1.3.0 | 1.3.0 |
mdx-mermaidnpm |
2.0.0-rc1 to 2.0.0-rc1 | 2.0.0-rc2 |
mdx-mermaidnpm |
2.0.0-rc1 up to 2.0.0-rc2 | 2.0.0-rc2 |
History
| Recorded | Changed | Sources |
|---|---|---|
| first indexed | CVE List, EUVD, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2022-36036 is a low vulnerability (CVSS 3.6) in Mdx-mermaid Project Mdx-mermaid, published August 29, 2022. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.40%, the 34th percentile. Fixed in mdx-mermaid 1.3.0.
References
github.com/sjwall/mdx-mermaid/security/advisories/GHSA-rvgm-35jw-q628
github.com/sjwall/mdx-mermaid/commit/f2b99386660fd13316823529c3f1314ebbcdfd2a
nvd.nist.gov/vuln/detail/CVE-2022-36036
github.com/advisories/GHSA-rvgm-35jw-q628
github.com/CVEProject/cvelistV5/tree/main/cves/2022/36xxx/CVE-2022-36036.json
github.com/sjwall/mdx-mermaid