CVE-2026-41159: Mermaid: Improper sanitization of configuration leads to CSS injection
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.
Security readout for executives and security teams
Plain-English summary
Mermaid can let attacker-controlled diagram configuration inject CSS that affects the surrounding web page, not just the diagram. Impact is mainly page defacement and limited data exposure through CSS-based techniques. This matters for products or internal portals that render Mermaid content from users or untrusted sources.
Executive priority
Treat as a near-term remediation for user-content platforms, documentation portals, and SaaS features that render Mermaid. It is not described as actively exploited, but it can affect page integrity and limited confidentiality if untrusted content is rendered.
Technical view
CVE-2026-41159 affects mermaid-js Mermaid before 10.9.6 and 11.15.0. Default configuration improperly sanitizes fontFamily, altFontFamily, and themeCSS. Stylis scope handling can let CSS escape Mermaid’s automatic scoping, and certain at-rules may be hoisted globally. CVSS v4.0 is 5.3.
Likely exposure
Exposure is most likely where web applications render Mermaid diagrams or accept Mermaid configuration from untrusted users, documents, wikis, issue trackers, or Markdown pipelines. Systems using only trusted, server-controlled diagrams have lower risk.
Exploitation context
The CVSS vector indicates network reachability, low complexity, no privileges, and required user interaction. The source bundle does not show CISA KEV listing or confirmed active exploitation. Abuse requires a victim application to render attacker-influenced Mermaid content or configuration.
Researcher notes
Focus review on Mermaid configuration sanitization and Stylis scoping behavior. The advisory names fontFamily, altFontFamily, themeCSS, :not(&) scope escape, and global at-rule hoisting. Avoid assuming broader XSS unless separately proven in the target application.
Mitigation direction
Upgrade Mermaid to 10.9.6 or 11.15.0, as applicable.
Identify applications that render untrusted Mermaid diagrams or configuration.
Restrict user control over Mermaid themeCSS, fontFamily, and altFontFamily settings.
Review Mermaid’s advisory and release notes for deployment-specific guidance.
Prioritize public-facing or multi-tenant Markdown and documentation platforms.
Validation and detection
Check package manifests and lockfiles for Mermaid versions below 10.9.6 or 11.15.0.
Confirm deployed bundles include the upgraded Mermaid release.
Map where Mermaid rendering accepts user-supplied diagrams or configuration.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cwe · medium confidence lookup
CWE-94: Code execution behavior lookup
Code execution and unsafe deserialization weaknesses often justify reviewing execution behavior and process telemetry. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
CWE-94 · source CWE mapping
Improper Control of Generation of Code ('Code Injection')
Improper Control of Generation of Code ('Code Injection') represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.