Back to list

Mermaid: Improper sanitization of `classDef` in state diagrams leads to HTML injection — CVE-2026-41149

GitHub · GitHub · CVE-2026-41149

ID
CVE-2026-41149
Date
Updated
Activity
Source
GitHub
Vendor
GitHub
Threat
medium
CVSS
5.3

Summary

### Impact Under the default configuration, Mermaid state diagram's `classDef` allow DOM injection that escapes the SVG, although `<script>` tags are removed, preventing XSS. #### Proof-of-concept ``` stateDiagram-v2 classDef xss fill:red</style></svg><style>*{x:x;y:y;overflow:visible!important;contain:none!important;transform:none!important;filter:none!important;clip-path:none!important}</style><div…

Product

npm: mermaid

What to do

General, cautious steps (verify details in the official source):

  • Review exposure and plan remediation based on risk and environment.
  • Identify affected product versions in your inventory and verify whether you are impacted.
  • Apply vendor patches/updates or recommended mitigations as soon as available.
  • Read the official advisory for exact affected versions and remediation steps.

Official advisory

Related advisories