Mermaid · Mermaid · CVE-2026-41159
**Name of the Vulnerable Software and Affected Versions**
Mermaid versions prior to 11.15.0
Mermaid versions prior to 10.9.6
**Description**
Default configuration allows the injection of CSS that applies outside of the Mermaid diagram. This occurs through the `fontFamily`, `themeCSS`, and `altFontFamily` configuration options, exploiting how stylis handles scope references. Specifically, using `:not(&)` escapes automatic scoping, allowing styles to be applied to all page elements. Additionally, global at-rules such as `@font-face`, `@keyframes`, and `@counter-style` can be injected as they are hoisted to the top level. This can lead to page defacement and the exfiltration of DOM attributes using CSS `:has()` selectors.
**Recommendations**
Update to version 11.15.0 or later.
Update to version 10.9.6 or later.
Set the `secure` configuration value to avoid allowing diagrams to modify `fontFamily`, `themeCSS`, `altFontFamily`, and `themeVariables`.
Set `securityLevel` to `sandbox` to prevent the issue.