CVE-2024-53986 Possible XSS vulnerability with certain configurations of rails-html-sanitizer 1.6.0

Low 2.3 Published Updated

Attackers can inject malicious scripts via XSS in Rails applications using specific HTML sanitizer configurations allowing math and style tags.

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-53986?

CVE-2024-53986 is a low-severity cross-site scripting vulnerability in rails-html-sanitizer, published on 2 Dec 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

rails-html-sanitizer is responsible for sanitizing HTML fragments in Rails applications. There is a possible XSS vulnerability with certain configurations of Rails::HTML::Sanitizer 1.6.0 when used with Rails >= 7.1.0. A possible XSS vulnerability with certain configurations of Rails::HTML::Sanitizer may allow an attacker to inject content if HTML5 sanitization is enabled and the application developer has overridden the sanitizer's allowed tags where the "math" and "style" elements are both explicitly allowed. This vulnerability is fixed in 1.6.1.

Weakness: CWE-79

Which versions are affected by CVE-2024-53986?

2 open source packages ship an affected version, including rails-html-sanitizer. It affects 1 product.

PackageAffectedFixed in
rails-html-sanitizer RubyGemsFrom 1.6.01.6.1
rails-html-sanitizer RubyGemsFrom 1.6.01.6.1

Products include Rubyonrails Rails Html Sanitizers.

How do I fix CVE-2024-53986?

Upgrade rails-html-sanitizer to 1.6.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-2024-53986 being exploited?

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

Sources

Also known as GHSA-638j-pmjw-jq48, UBUNTU-CVE-2024-53986.

Is CVE-2024-53986 in your software?

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

Check your SBOMs for free