CVE-2021-32696 Passing in a non-string 'html' argument can lead to unsanitized output

Low 3.7 Published Updated

Attackers can trigger XSS in applications using striptags by passing array-like objects, bypassing sanitization via type confusion.

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

What is CVE-2021-32696?

CVE-2021-32696 is a low-severity cross-site scripting vulnerability in ericnorris striptags, published on 18 Jun 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

The npm package "striptags" is an implementation of PHP's strip_tags in Typescript. In striptags before version 3.2.0, a type-confusion vulnerability can cause `striptags` to concatenate unsanitized strings when an array-like object is passed in as the `html` parameter. This can be abused by an attacker who can control the shape of their input, e.g. if query parameters are passed directly into the function. This can lead to a XSS.

Weakness: CWE-843, CWE-79, CWE-241

Which versions are affected by CVE-2021-32696?

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

PackageAffectedFixed in
striptags npmAll versions3.2.0
striptags npmAll versions3.2.0

Products include Striptags Project Striptags.

How do I fix CVE-2021-32696?

Upgrade striptags to 3.2.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-2021-32696 being exploited?

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

Sources

Also known as GHSA-qxg5-2qff-p49r.

Is CVE-2021-32696 in your software?

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

Check your SBOMs for free