CVE-2024-21535 Cross site scripting in markdown-to-jsx

Medium 6.1 Published Updated

An attacker can execute arbitrary code by injecting a malicious iframe into markdown content processed by the markdown-to-jsx 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 CVE-2024-21535?

CVE-2024-21535 is a medium-severity cross-site scripting vulnerability in markdown-to-jsx, published on 15 Oct 2024. 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 the package markdown-to-jsx before 7.4.0 are vulnerable to Cross-site Scripting (XSS) via the src property due to improper input sanitization. An attacker can execute arbitrary code by injecting a malicious iframe element in the markdown.

Weakness: CWE-79

Which versions are affected by CVE-2024-21535?

2 open source packages ship an affected version, including markdown-to-jsx. It affects 1 product.

PackageAffectedFixed in
markdown-to-jsx npmAll versions7.4.0
markdown-to-jsx npmAll versions7.4.0

Products include Quantizor Markdown-to-Jsx.

How do I fix CVE-2024-21535?

Upgrade markdown-to-jsx to 7.4.0 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-2024-21535 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-21535 exists.

Sources

Also known as DEBIAN-CVE-2024-21535, GHSA-4wx3-54gh-9fr9, UBUNTU-CVE-2024-21535.

Is CVE-2024-21535 in your software?

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

Check your SBOMs for free