{"id":"CVE-2026-41159","published":"2026-05-29T13:53:10Z","modified":"2026-07-01T19:21:36Z","title":"Mermaid: Improper sanitization of configuration leads to CSS injection","vendor":"mermaid-js","product":"mermaid","tier":"tail","description":{"text":"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.","provenance":"source","from":"CVE.org"},"cvss":{"score":5.3,"severity":"MEDIUM","version":"4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:L/VA:N/SC:L/SI:L/SA:L","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00549,"percentile":0.39568,"provenance":"source"},"cwes":[{"id":"CWE-94","name":"Improper Control of Generation of Code"}],"references":[{"url":"https://github.com/mermaid-js/mermaid/security/advisories/GHSA-87f9-hvmw-gh4p","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/mermaid-js/mermaid/commit/64769738d5b59211e1decb471ffbaca8afec51aa","tags":["x_refsource_MISC"]},{"url":"https://github.com/mermaid-js/mermaid/commit/a9d9f0d8eb790349121508688cd338253fd80d76","tags":["x_refsource_MISC"]},{"url":"https://github.com/mermaid-js/mermaid/releases/tag/mermaid@11.15.0","tags":["x_refsource_MISC"]},{"url":"https://github.com/mermaid-js/mermaid/releases/tag/v10.9.6","tags":["x_refsource_MISC"]}],"priority":{"score":11.6,"factors":[{"name":"EPSS percentile","points":7.91},{"name":"CVSS severity","points":3.71}]},"vendorSlug":"mermaid-js","affectedVersions":[{"vendor":"mermaid-js","product":"mermaid","versions":[">= 11.0.0-alpha.1, < 11.15.0","< 10.9.6"]}],"ssvc":{"exploitation":"none","automatable":"no","technicalImpact":"partial","timestamp":"2026-05-29T15:02:42.708368Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"npm","package":"mermaid","vulnerableRanges":[">=11.0.0-alpha.1, <11.15.0","<10.9.6"],"patched":["11.15.0","10.9.6"],"from":["GHSA-87f9-hvmw-gh4p"],"provenance":"source"}],"summary":{"text":"Mermaid, the JavaScript diagramming tool that uses Markdown-inspired text to create and modify diagrams and charts, has an improper sanitization flaw in its default configuration that allows CSS injection through the fontFamily, themeCSS, and altFontFamily options, with the injected styles escaping the diagram's scoping and applying outside it. An attacker who can supply diagram configuration and get a user to view the rendered content (network access and user interaction required, no authentication) can deface the page and exfiltrate DOM attribute values through CSS :has() selectors.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T21:53:34Z"},"euvd":{"id":"EUVD-2026-33324","exploited":false,"provenance":"source"}}