CVE-2026-41149: CWE-94: Improper Control of Generation of Code ('Code Injection') in mermaid-js mermaid
Mermaid versions 10. 9. 5 and earlier, as well as 11. 0. 0-alpha. 1 through 11. 14. 0, are vulnerable to an HTML injection issue via the classDef directive in state diagrams. This vulnerability allows DOM injection that escapes the SVG context, though script tags are stripped to prevent XSS. The issue is fixed in versions 10.
AI Analysis
Technical Summary
CVE-2026-41149 is an improper control of code generation vulnerability (CWE-94) in the mermaid-js mermaid tool. The vulnerability arises from the classDef directive in state diagrams allowing DOM injection that escapes the SVG context, leading to HTML injection. Although <script> tags are removed, preventing direct cross-site scripting, the injection could still affect the DOM. Affected versions include all versions up to 10.9.5 and from 11.0.0-alpha.1 up to but not including 11.15.0. The vulnerability has been addressed in versions 10.9.6 and 11.15.0. Developers unable to upgrade immediately can mitigate the issue by enabling the "securityLevel": "sandbox" setting, which confines rendering to a sandboxed iframe.
Potential Impact
The vulnerability allows HTML injection through the classDef directive, which can lead to DOM manipulation outside the SVG context. While direct script injection is prevented by stripping <script> tags, the injection could still affect the integrity of the rendered content. The CVSS 4.0 score is 5.3 (medium severity), indicating a moderate risk with network attack vector, no privileges required, and user interaction needed.
Mitigation Recommendations
A fix is available in mermaid versions 10.9.6 and 11.15.0. Users should upgrade to these or later versions to remediate the vulnerability. If immediate upgrading is not feasible, setting the configuration option "securityLevel" to "sandbox" provides a temporary workaround by rendering diagrams in a sandboxed iframe, preventing the injection issue.
CVE-2026-41149: CWE-94: Improper Control of Generation of Code ('Code Injection') in mermaid-js mermaid
Description
Mermaid versions 10. 9. 5 and earlier, as well as 11. 0. 0-alpha. 1 through 11. 14. 0, are vulnerable to an HTML injection issue via the classDef directive in state diagrams. This vulnerability allows DOM injection that escapes the SVG context, though script tags are stripped to prevent XSS. The issue is fixed in versions 10.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
CVE-2026-41149 is an improper control of code generation vulnerability (CWE-94) in the mermaid-js mermaid tool. The vulnerability arises from the classDef directive in state diagrams allowing DOM injection that escapes the SVG context, leading to HTML injection. Although <script> tags are removed, preventing direct cross-site scripting, the injection could still affect the DOM. Affected versions include all versions up to 10.9.5 and from 11.0.0-alpha.1 up to but not including 11.15.0. The vulnerability has been addressed in versions 10.9.6 and 11.15.0. Developers unable to upgrade immediately can mitigate the issue by enabling the "securityLevel": "sandbox" setting, which confines rendering to a sandboxed iframe.
Potential Impact
The vulnerability allows HTML injection through the classDef directive, which can lead to DOM manipulation outside the SVG context. While direct script injection is prevented by stripping <script> tags, the injection could still affect the integrity of the rendered content. The CVSS 4.0 score is 5.3 (medium severity), indicating a moderate risk with network attack vector, no privileges required, and user interaction needed.
Mitigation Recommendations
A fix is available in mermaid versions 10.9.6 and 11.15.0. Users should upgrade to these or later versions to remediate the vulnerability. If immediate upgrading is not feasible, setting the configuration option "securityLevel" to "sandbox" provides a temporary workaround by rendering diagrams in a sandboxed iframe, preventing the injection issue.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-04-17T12:59:15.739Z
- Cvss Version
- 4.0
- State
- PUBLISHED
- Remediation Level
- null
Threat ID: 6a10dcbfe1370fbb485f73b4
Added to database: 5/22/2026, 10:46:23 PM
Last enriched: 5/22/2026, 10:59:46 PM
Last updated: 5/23/2026, 1:02:54 AM
Views: 7
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.