GHSA-w32g-5hqp-gg6q Cross-Site Scripting in mermaid

Not scored Published

An attacker can execute arbitrary JavaScript in a victim's browser by providing malicious input to the mermaid diagramming library.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
A user has to click or open something
Fix
Available

What is GHSA-w32g-5hqp-gg6q?

GHSA-w32g-5hqp-gg6q is a cross-site scripting vulnerability in mermaid, published on 2 Sep 2020. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

Official description

Versions of mermaid prior to 8.2.3 are vulnerable to Cross-Site Scripting. If malicious input such as A["<img src=invalid onerror=alert('XSS')></img>"] is provided to the application, it will execute the code instead of rendering it as text due to improper output encoding.

Recommendation

Upgrade to version 8.2.3 or later

Which versions are affected by GHSA-w32g-5hqp-gg6q?

2 open source packages ship an affected version, including mermaid.

PackageAffectedFixed in
mermaid npmAll versions8.2.3
mermaid npmAll versions8.2.3

How do I fix GHSA-w32g-5hqp-gg6q?

Upgrade mermaid to 8.2.3 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 GHSA-w32g-5hqp-gg6q being exploited?

There is no known exploitation of GHSA-w32g-5hqp-gg6q in the wild and no public exploit code.

Sources

Is GHSA-w32g-5hqp-gg6q in your software?

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

Check your SBOMs for free