CVE-2023-23627 Sanitize vulnerable to Cross-site Scripting via Improper neutralization of `noscript` element

Medium 6.1 Published Updated

Attackers can execute arbitrary scripts in browsers if the Sanitize library is configured with a custom allowlist permitting noscript elements.

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-2023-23627?

CVE-2023-23627 is a medium-severity cross-site scripting vulnerability in rgrove sanitize, published on 27 Jan 2023. 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

Sanitize is an allowlist-based HTML and CSS sanitizer. Versions 5.0.0 and later, prior to 6.0.1, are vulnerable to Cross-site Scripting. When Sanitize is configured with a custom allowlist that allows `noscript` elements, attackers are able to include arbitrary HTML, resulting in XSS (cross-site scripting) or other undesired behavior when that HTML is rendered in a browser. The default configurations do not allow `noscript` elements and are not vulnerable. This issue only affects users who are using a custom config that adds `noscript` to the element allowlist. This issue has been patched in version 6.0.1. Users who are unable to upgrade can prevent this issue by using one of Sanitize's default configs or by ensuring that their custom config does not include `noscript` in the element allowlist.

Weakness: CWE-79

Which versions are affected by CVE-2023-23627?

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

PackageAffectedFixed in
sanitize RubyGemsFrom 5.0.06.0.1
sanitize RubyGemsFrom 5.0.06.0.1

Products include Sanitize Project Sanitize.

How do I fix CVE-2023-23627?

Upgrade sanitize to 6.0.1 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-2023-23627 being exploited?

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

Sources

Also known as DEBIAN-CVE-2023-23627, GHSA-fw3g-2h3j-qmm7, UBUNTU-CVE-2023-23627.

Is CVE-2023-23627 in your software?

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

Check your SBOMs for free