PT-2026-39888 · Npm · Mermaid
Published
2026-05-11
·
Updated
2026-05-12
·
CVE-2026-41159
CVSS v4.0
5.3
Medium
| Vector | AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:L/VA:N/SC:L/SI:L/SA:L |
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.Fix
Code Injection
Found an issue in the description? Have something to add? Feel free to write us 👾
Weakness Enumeration
Related Identifiers
Affected Products
Mermaid