CVE-2026-41159 Details
Description
Mermaid is a JavaScript tool that uses Markdown-inspired text to create and modify diagrams and charts. Prior to 10.9.6 and 11.15.0, Mermaid's default configuration allows injecting CSS that applies outside of the Mermaid diagram via the fontFamily, themeCSS, and altFontFamily configuration options. The injected CSS exploits stylis's & (scope reference) handling. :not(&) escapes the #mermaid-xxx automatic scoping, applying styles to all page elements. Global at-rules (@font-face, @keyframes, @counter-style) are also injectable as stylis hoists them to top level. This allows page defacement and DOM attribute exfiltration via CSS :has() selectors. This vulnerability is fixed in 10.9.6 and 11.15.0.
A vulnerability in Mermaid, a JavaScript tool for creating diagrams and charts, allows for CSS injection that affects elements outside of the Mermaid diagrams. This issue is present in versions prior to 10.9.6 and 11.15.0. The vulnerability arises from improper sanitization of configuration options related to font styling, which can be exploited to escape automatic scoping and apply styles globally. Additionally, certain at-rules can be injected, leading to potential page defacement and unauthorized access to DOM attributes using specific CSS selectors.
Users can upgrade to Mermaid versions 10.9.6 or 11.15.0, both of which address this vulnerability. If an upgrade is not possible, the 'secure' configuration option can be set to prevent diagrams from modifying certain font-related settings. Alternatively, setting the 'securityLevel' to 'sandbox' will also mitigate this issue.
Metrics
CVSS 4.0 Severity and Vector Strings:
CVSS 3.x Severity and Vector Strings:
No data available for CVSS Version 2.0 on this CVE.
CISA-ADP
Assessed May 29, 2026References to Advisories, Solutions, and Tools
By selecting these links, you will be leaving this site. These are references gathered from the official CVE record and are not endorsed by Volerion.
Weakness Enumeration
| CWE-ID | CWE Name | Source |
|---|---|---|
| CWE-94 | Improper Control of Generation of Code ('Code Injection') | [email protected] |
Affected Products
| Product | Versions |
|---|---|
| mermaid project mermaid | < 10.9.6 >= 11.0.0, < 11.15.0 |
CPE
Remediation
| |
Change History
6 change records found show changes
| Date | Action | Recorded By |
|---|---|---|
| Jul 21, 2026 | CVE Translated | [email protected] |
| Jul 1, 2026 | CVE Modified | [email protected] |
| Jun 17, 2026 | CVE Modified | [email protected] |
| Jun 17, 2026 | CVE Modified | CISA-ADP |
| Jun 1, 2026 | Initial Analysis | [email protected] |
| May 29, 2026 | New CVE Received | [email protected] |