# Mermaid prototype pollution in bundled DOMPurify

Source: https://junglewise.ai/threats/mermaid-prototype-pollution-in-bundled-dompurify-655b89f2  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2024-10-22. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

Severity: low · CVSS 3.1 · Published 2024-10-22

Mermaid is a popular JavaScript diagram and chart rendering library used in web applications. Certain bundled versions of Mermaid contain a vulnerable version of the DOMPurify HTML sanitization library, which can be bypassed through prototype pollution attacks to inject malicious scripts (XSS), potentially compromising user sessions or stealing sensitive data from users viewing affected diagrams.

Technologies: [mermaid (npm)](https://junglewise.ai/threats/technologies/mermaid). Vendors: [npm](https://junglewise.ai/threats/vendors/npm).

## Quick answers

**Is This vulnerability exploited in the wild?** No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.

**How severe is This vulnerability?** Low severity, with a CVSS score of 3.1, published 22 October 2024.

**Which products and versions are affected?** mermaid (npm) SEMVER:introduced=0,fixed=10.9.3.

**Is there a fix for This vulnerability?** Yes. mermaid (npm): upgrade to 10.9.3 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is This vulnerability attacked?** It is attacked over the network, in a software library.

**Am I affected?** Check whether you run mermaid (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- mermaid (npm): upgrade to 10.9.3 or later

  ```sh
  npm install mermaid@10.9.3
  ```


## Technical details

This is a prototype pollution vulnerability (CWE-1321) in DOMPurify that was bundled into specific Mermaid distribution files. The vulnerability allows attackers to use malicious HTML with special nesting techniques to bypass DOMPurify's depth-checking protections, enabling XSS payloads to execute in the browser. The affected bundled files are dist/mermaid.min.js, dist/mermaid.js, dist/mermaid.esm.mjs, and dist/mermaid.esm.min.mjs. Users are network-exposed when loading these files from CDNs or local sources. The default NPM export and dist/mermaid.core.mjs are not affected. Patches are available in Mermaid 10.9.3 and 11.0.0.

## Affected products

- Mermaid Mermaid <= 10.9.2

## Timeline

- 2024-10-22: disclosed: GHSA-m4gq-x24j-jpmf published
- 2024-10-22: patched: Patches available in versions 10.9.3 and 11.0.0

## References

- [https://github.com/cure53/DOMPurify/security/advisories/GHSA-mmhx-hmjr-r674](https://github.com/cure53/DOMPurify/security/advisories/GHSA-mmhx-hmjr-r674)
- [https://github.com/mermaid-js/mermaid/security/advisories/GHSA-m4gq-x24j-jpmf](https://github.com/mermaid-js/mermaid/security/advisories/GHSA-m4gq-x24j-jpmf)

## Related threats

- [Mermaid radar diagrams denial of service via unchecked ticks input](https://junglewise.ai/threats/cve-2026-71439-mermaid-radar-diagrams-denial-of-service-via-unchecked-ticks)
- [Mermaid prototype pollution in configuration APIs](https://junglewise.ai/threats/cve-2026-71438-mermaid-prototype-pollution-in-configuration-apis)
- [Mermaid prototype pollution in architecture-beta diagrams](https://junglewise.ai/threats/cve-2026-71437-mermaid-prototype-pollution-in-architecture-beta-diagrams)
- [Mermaid infinite loop in XY Charts axis processing](https://junglewise.ai/threats/cve-2026-71436-mermaid-infinite-loop-in-xy-charts-axis-processing)
- [Mermaid CSS injection via sibling combinators](https://junglewise.ai/threats/cve-2026-50159-mermaid-css-injection-via-sibling-combinators)
