Mermaid: Improper sanitization of `classDef` in state diagrams leads to HTML injection
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- Passive
- Attack complexity
- Low
- Attack requirements
- None
- Impact type
- Code execution
- Confidentiality · integrity · availability
- None · Low · None
- Fix status
- Partial Red Hat: 2 without a fix
Attack profile from CVSS 4.0 · CNA. Fix status from CNA, GitHub and Red Hat. Impact type from CWE-94.
Summary
Mermaid is a JavaScript tool that uses Markdown-inspired text to create and modify diagrams and charts. Versions 10.9.5 and earlier, as well as 11.0.0-alpha.1 through 11.14.0, are vulnerable to HTML injection under the default configuration. Specifically, the classDef directive in Mermaid state diagrams permits DOM injection that escapes the SVG context. However, <script> tags are stripped, which prevents cross-site scripting (XSS). This issue has been fixed in versions 10.9.6 and 11.15.0. If developers are unable to immediately upgrade, they can work around this issue by setting "securityLevel": "sandbox", which prevents the issue by rendering the mermaid diagram in a sandboxed <iframe>.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- Poc
- Automatable
- No
- Technical impact
- Partial
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| mermaid-js | mermaid | 11.0.0-alpha.1 to before 11.15.0; before 10.9.6 | 11.15.0, 10.9.6 | Patch available | CNA |
| — | mermaid (npm) | 11.0.0-alpha.1 to before 11.15.0 | 11.15.0 | Patch available | GHSA-ghcm-xqfw-q4vr |
| — | mermaid (npm) | before 10.9.6 | 10.9.6 | Patch available | GHSA-ghcm-xqfw-q4vr |
- mermaid Vendormermaid-js Affected 11.0.0-alpha.1 to before 11.15.0; before 10.9.6 Fixed in 11.15.0, 10.9.6 Patch available CNA
- mermaid (npm) Vendor— Affected 11.0.0-alpha.1 to before 11.15.0 Fixed in 11.15.0 Patch available GHSA-ghcm-xqfw-q4vr
- mermaid (npm) Vendor— Affected before 10.9.6 Fixed in 10.9.6 Patch available GHSA-ghcm-xqfw-q4vr
CPE names Threatist (inferred) · 1
Inferred from how NVD named this product before; not given by a source.
| CPE | Versions | Role | Vendor |
|---|---|---|---|
| cpe:2.3:a:mermaid_project:mermaid:*:*:*:*:*:*:*:* | — | — | mermaid-js |
- cpe:2.3:a:mermaid_project:mermaid:*:*:*:*:*:*:*:* Versions — — ·mermaid-js
Remediation
- Fix · CNA mermaid (mermaid-js) Fixed in 11.15.0, 10.9.6
- Fix · GHSA-ghcm-xqfw-q4vr mermaid (npm) Fixed in 11.15.0 Advisory →
- Fix · GHSA-ghcm-xqfw-q4vr mermaid (npm) Fixed in 10.9.6 Advisory →
Vendor assessments
Red Hat
Red Hat rating: Moderate. Red Hat's page for this CVE →
| Product | Status | Plan or fix |
|---|---|---|
| Red Hat Build of Podman Desktop | Affected | No fix yet: Fix deferred |
| Red Hat OpenShift AI (RHOAI) | Affected | No fix yet: Fix deferred |
Timeline
- 2026-10-02 Threatist record created from CVE-2026-41149
- 2026-10-03 Alias added: GHSA-ghcm-xqfw-q4vr
References
Other 7
- https://github.com/mermaid-js/mermaid/security/advisories/GHSA-ghcm-xqfw-q4vr
- https://github.com/mermaid-js/mermaid/commit/37ff937f1da2e19f882fd1db01235db4d01f4056
- https://github.com/mermaid-js/mermaid/commit/4e2d512bf5bf6f9de1a8f0a48da78dc4d09ac4f3
- https://github.com/mermaid-js/mermaid
- https://github.com/mermaid-js/mermaid/releases/tag/mermaid%4011.15.0
- https://github.com/mermaid-js/mermaid/releases/tag/v10.9.6
- https://mermaid.js.org/config/schema-docs/config.html#securitylevel
More mermaid-js vulnerabilities
- TI-2026-29778 Mermaid Gantt Charts are vulnerable to an Infinite Loop DoS CVSS 4.0MEDIUM 5.3
- TI-2025-34615 Mermaid improperly sanitizes of sequence diagram labels leading to XSS CVSS 4.0MEDIUM 5.3
- TI-2026-50057 Mermaid Architecture diagrams are vulnerable to prototype pollution CVSS 4.0MEDIUM 6.5
- TI-2022-13152 Arbitrary `CSS` injection into the generated graph affecting the container HTML in mermaid.js CVSS 3.1MEDIUM 6.1
- TI-2024-25762 Cross-site Scripting in ZenUML CVSS 3.1MEDIUM 5.4
- TI-2025-34614 Mermaid does not properly sanitize architecture diagram iconText leading to XSS CVSS 4.0MEDIUM 5.1
Sources
- CVE-2026-41149 · CVE Program
- CVE-2026-41149 · NVD
- FIRST EPSS
- GHSA-ghcm-xqfw-q4vr · GitHub Advisory Database · CC BY 4.0
- CVE-2026-41149 · Red Hat security data · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences