CVE-2021-31712 Cross-site Scripting in React Draft Wysiwyg

Medium 5.4 Published Updated

An attacker can inject JavaScript via a malicious link target in the React Draft Wysiwyg editor, leading to cross-site scripting when drafts are shared.

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

What is CVE-2021-31712?

CVE-2021-31712 is a medium-severity cross-site scripting vulnerability in n/a, published on 24 Apr 2021. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.

Official description

react-draft-wysiwyg (aka React Draft Wysiwyg) before 1.14.6 allows a javascript: URi in a Link Target of the link decorator in decorators/Link/index.js when a draft is shared across users, leading to XSS.

Weakness: CWE-79

Which versions are affected by CVE-2021-31712?

2 open source packages ship an affected version, including react-draft-wysiwyg. It affects 1 product.

PackageAffectedFixed in
react-draft-wysiwyg npmAll versions1.14.6
react-draft-wysiwyg npmAll versions1.14.6

Products include React Draft Wysiwyg Project React Draft Wysiwyg.

How do I fix CVE-2021-31712?

Upgrade react-draft-wysiwyg to 1.14.6 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-31712 being exploited?

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

Sources

Also known as GHSA-qcg2-h349-vwm3.

Is CVE-2021-31712 in your software?

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

Check your SBOMs for free