# CVE-2026-41159: Mermaid: Improper sanitization of configuration leads to CSS injection

- Severity: Medium 5.3 (CVSS:4.0, scored by GitHub_M) `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`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.49%, higher than 43% of CVEs (2026-12-01)
- Published: 2026-05-11T19:37:00.000Z
- Modified: 2026-09-10T03:51:04.895Z
- Also known as: GHSA-87f9-hvmw-gh4p
- Weaknesses: CWE-94
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial
- Assigned by: GitHub_M

## Description

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.

(As written by CVE List.)

## Affected

- mermaid-js mermaid: >= 11.0.0-alpha.1, < 11.15.0; < 10.9.6
- mermaid (npm): from 11.0.0-alpha.1 before 11.15.0; before 10.9.6
- mermaid_project mermaid: before 10.9.6; from 11.0.0 before 11.15.0

## Every score

- GitHub_M: CVSS:4.0 5.3 Medium `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`
- GitHub: CVSS:4.0 Medium `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`
- NVD: CVSS:3.1 5.3 Medium `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L`

## References

- <https://github.com/mermaid-js/mermaid/security/advisories/GHSA-87f9-hvmw-gh4p> (third-party-advisory, web)
- <https://github.com/mermaid-js/mermaid/commit/64769738d5b59211e1decb471ffbaca8afec51aa> (web)
- <https://github.com/mermaid-js/mermaid/commit/a9d9f0d8eb790349121508688cd338253fd80d76> (web)
- <https://github.com/mermaid-js/mermaid/releases/tag/mermaid@11.15.0> (release-notes, web)
- <https://github.com/mermaid-js/mermaid/releases/tag/v10.9.6> (release-notes, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2026-41159> (advisory)
- <https://github.com/mermaid-js/mermaid> (package)
- <https://github.com/mermaid-js/mermaid/releases/tag/mermaid%4011.15.0> (web)

## Sources

- CVE List: [CVE-2026-41159](https://www.cve.org/CVERecord?id=CVE-2026-41159), CVE Terms of Use, modified 2026-07-01
- GitHub Advisory Database: [GHSA-87f9-hvmw-gh4p](https://github.com/advisories/GHSA-87f9-hvmw-gh4p), CC-BY-4.0, modified 2026-09-10
- NVD: [CVE-2026-41159](https://nvd.nist.gov/vuln/detail/CVE-2026-41159), Public domain, modified 2026-07-21

---

Page: https://cve.day/CVE-2026-41159 · Whole record: https://cve.day/CVE-2026-41159.json · Rebuilt by cve.day 2026-11-25T22:59:23.325Z
