Mermaid: Improper sanitization of `classDef` in state diagrams leads to HTML injection
- Severity:
- Medium
Description
Under the default configuration, Mermaid state diagram’s classDef allow DOM injection that escapes the SVG, although <script> tags are removed, preventing XSS.
Recommendation
Update the mermaid package to the latest compatible version. Followings are version details:
Affected version(s): **<= 10.9.5 >= 11.0.0-alpha.1, <= 11.14.0** Patched version(s): **10.9.6 11.15.0**
References
Related Issues
- Mermaid: Improper sanitization of `classDefs` in diagrams leads to CSS injection - CVE-2026-41148
- Mermaid: Improper sanitization of configuration leads to CSS injection - CVE-2026-41159
- beautiful-mermaid contains an SVG attribute injection issue that can lead to cross-site scripting (XSS) - CVE-2026-26226
- Marp Core allows XSS by improper neutralization of HTML sanitization - CVE-2024-56510
You might also like:
- Tags:
- npm
- mermaid
Anything's wrong? Let us know Last updated on May 12, 2026


