CVE-2026-50159: CWE-94: Improper Control of Generation of Code ('Code Injection') in mermaid-js mermaid
Mermaid versions prior to 10.9.8 and 11.16.1 are vulnerable to CSS injection via sibling combinator selectors generated from diagram-supplied class or id names. This allows an attacker who can supply diagram text to inject arbitrary CSS into the rendered page, potentially altering the appearance or behavior of unrelated page elements. The vulnerability is fixed in versions 10.9.8 and 11.16.1.
AI Analysis
Technical Summary
Mermaid, a JavaScript tool for creating diagrams from Markdown-inspired text, has a vulnerability classified as CWE-94 (Improper Control of Generation of Code) that allows CSS injection. Specifically, prior to versions 10.9.8 and 11.16.1, Mermaid generates sibling combinator selectors from user-supplied diagram class or id names without proper sanitization, enabling an attacker who can supply diagram text to inject arbitrary CSS into the rendered page. This can affect unrelated page elements' appearance or behavior. The issue is resolved in versions 10.9.8 and 11.16.1.
Potential Impact
An attacker able to supply diagram text can inject arbitrary CSS into pages rendered by vulnerable Mermaid versions, potentially manipulating the visual presentation or behavior of unrelated elements on the page. This could lead to UI manipulation or visual spoofing but does not directly indicate code execution or data compromise. The CVSS 4.0 score is 5.3 (medium severity), reflecting network attack vector, low complexity, no privileges required, user interaction needed, and limited impact on confidentiality, integrity, and availability.
Mitigation Recommendations
Upgrade Mermaid to version 10.9.8 or later, or 11.16.1 or later, where this CSS injection vulnerability is fixed. No other mitigation is indicated or required according to the available data.
CVE-2026-50159: CWE-94: Improper Control of Generation of Code ('Code Injection') in mermaid-js mermaid
Description
Mermaid versions prior to 10.9.8 and 11.16.1 are vulnerable to CSS injection via sibling combinator selectors generated from diagram-supplied class or id names. This allows an attacker who can supply diagram text to inject arbitrary CSS into the rendered page, potentially altering the appearance or behavior of unrelated page elements. The vulnerability is fixed in versions 10.9.8 and 11.16.1.
CVSS v4.0
Score 5.3medium
Affected software
mermaid-js
mermaid
pkg:npm/mermaid-js/mermaidRun on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
Mermaid, a JavaScript tool for creating diagrams from Markdown-inspired text, has a vulnerability classified as CWE-94 (Improper Control of Generation of Code) that allows CSS injection. Specifically, prior to versions 10.9.8 and 11.16.1, Mermaid generates sibling combinator selectors from user-supplied diagram class or id names without proper sanitization, enabling an attacker who can supply diagram text to inject arbitrary CSS into the rendered page. This can affect unrelated page elements' appearance or behavior. The issue is resolved in versions 10.9.8 and 11.16.1.
Potential Impact
An attacker able to supply diagram text can inject arbitrary CSS into pages rendered by vulnerable Mermaid versions, potentially manipulating the visual presentation or behavior of unrelated elements on the page. This could lead to UI manipulation or visual spoofing but does not directly indicate code execution or data compromise. The CVSS 4.0 score is 5.3 (medium severity), reflecting network attack vector, low complexity, no privileges required, user interaction needed, and limited impact on confidentiality, integrity, and availability.
Mitigation Recommendations
Upgrade Mermaid to version 10.9.8 or later, or 11.16.1 or later, where this CSS injection vulnerability is fixed. No other mitigation is indicated or required according to the available data.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-06-03T20:54:20.432Z
- Cvss Version
- 4.0
- State
- PUBLISHED
Threat ID: 6a750706bf8831d5395f5a96
Added to database: 08/06/2026, 22:13:26 UTC
Last enriched: 08/14/2026, 16:06:11 UTC
Last updated: 09/21/2026, 22:01:35 UTC
Views: 42
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.