Quick answers
- Is CVE-2021-35513 exploited in the wild?
- No. Junglewise Threat Intelligence has no report of CVE-2021-35513 being exploited in the wild.
- How severe is CVE-2021-35513?
- Low severity, with a CVSS score of 3.1, published 10 December 2021.
- Which products and versions are affected?
- mermaid (npm) SEMVER:introduced=0,fixed=8.11.0.
- Is there a fix for CVE-2021-35513?
- Yes. mermaid (npm): upgrade to 8.11.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
- How is CVE-2021-35513 attacked?
- It is attacked over the network.
- Am I affected by CVE-2021-35513?
- Check whether you run mermaid (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.
How to fix
- mermaid (npm): upgrade to 8.11.0 or later
npm install mermaid@8.11.0
Technical details
Mermaid is a diagram rendering library for web applications. The vulnerability is a stored/reflected XSS flaw in the antiscript option, which claims to block malicious script content. The root cause is inadequate sanitization of javascript: URLs in diagram elements (such as links in SVG nodes). An attacker can craft a malicious diagram definition containing javascript: protocol URLs that execute arbitrary JavaScript when a user views the rendered diagram in a browser. No authentication is required; the attack vector is network-based and requires user interaction (opening/viewing the diagram). The vulnerability was patched in version 8.11.0, which adds proper filtering of javascript: URLs when antiscript mode is enabled. The fix involves stripping javascript: protocol handlers before rendering diagram elements.
Affected products
- mermaid-js mermaid before 8.11.0
Identifiers
- CVE-2021-35513
- GHSA-4f6x-49g2-99fm
Timeline
- 2021-06-27: disclosed: Vulnerability reported and discussed in GitHub issue #2122
- 2021-06-27: patched: Fix merged in PR #2123
- 2021-12-10: advisory: GitHub Security Advisory GHSA-4f6x-49g2-99fm published