RCE in Mermaid-Js Mermaid

CVE-2026-41159

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.

Vulnerability class: RCE (Remote Code Execution)

EPSS: 0.005 (40.9th percentile) — read the EPSS interpretation.

CVSS v3 metric

CVSS v3 base score 5.3 (Medium). Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L.

Affected products

Weakness classification (CWE)

References

Frequently asked questions

What is CVE-2026-41159?
CVE-2026-41159 is a medium-severity vulnerability in Mermaid-Js Mermaid, classified under Code Injection. CVSS score: 5.3/10. Published 2026-05-29.
How severe is CVE-2026-41159?
Medium severity. CVSS v3 base score is 5.3 out of 10.