CVE-2021-43861 Incorrect sanitisation function leads to `XSS`

High 7.2 Published Updated

Attackers can execute arbitrary JavaScript on victims' machines via malicious diagrams in the Mermaid library.

Exploited in the wild
Not known
Login needed
An administrator
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2021-43861?

CVE-2021-43861 is a high-severity cross-site scripting vulnerability in mermaid-js mermaid, published on 30 Dec 2021. An attacker needs administrator access to exploit it, with no action from the victim.

Official description

Mermaid is a Javascript based diagramming and charting tool that uses Markdown-inspired text definitions and a renderer to create and modify complex diagrams. Prior to version 8.13.8, malicious diagrams can run javascript code at diagram readers' machines. Users should upgrade to version 8.13.8 to receive a patch. There are no known workarounds aside from upgrading.

Weakness: CWE-79, CWE-20

Which versions are affected by CVE-2021-43861?

2 open source packages ship an affected version, including mermaid. It affects 1 product.

PackageAffectedFixed in
mermaid npmAll versions8.13.8
mermaid npmAll versions8.13.8

Products include Mermaid Project Mermaid.

How do I fix CVE-2021-43861?

Upgrade mermaid to 8.13.8 or later.

Escape output for the context it lands in and set a strict Content Security Policy. Upgrading the affected component is the real fix. More about Cross-site scripting.

Is CVE-2021-43861 being exploited?

There is no known exploitation of CVE-2021-43861 in the wild and no public exploit code.

Sources

Also known as DEBIAN-CVE-2021-43861, GHSA-p3rp-vmj9-gv6v, UBUNTU-CVE-2021-43861.

Is CVE-2021-43861 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free