Vulnerability · Published Dec 14, 2022 · Assigned by GitHub_M

CVE-2022-23520rails-html-sanitizer contains an incomplete fix for an XSS vulnerability

Medium 6.1

In plain English

A medium-severity cross-site scripting in rails-html-sanitizer from rails. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 1.2% (higher than 68% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)6.1Medium
Exploit odds (30 days)1.2%top 32.0% of all CVEs
Exploited in the wildNo reportsnot in CISA KEV
Attack toolingNoneno public tooling known

Official description

rails-html-sanitizer is responsible for sanitizing HTML fragments in Rails applications. Prior to version 1.4.4, there is a possible XSS vulnerability with certain configurations of Rails::Html::Sanitizer due to an incomplete fix of CVE-2022-32209. Rails::Html::Sanitizer may allow an attacker to inject content if the application developer has overridden the sanitizer's allowed tags to allow both "select" and "style" elements. Code is only impacted if allowed tags are being overridden. This issue is patched in version 1.4.4. All users overriding the allowed tags to include both "select" and "style" should either upgrade or use this workaround: Remove either "select" or "style" from the overridden allowed tags. NOTE: Code is _not_ impacted if allowed tags are overridden using either the :tags option to the Action View helper method sanitize or the :tags option to the instance method SafeListSanitizer#sanitize.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
Debian:12ruby-rails-html-sanitizer1.4.4-1DEBIAN-CVE-2022-23520
Debian:13ruby-rails-html-sanitizer1.4.4-1DEBIAN-CVE-2022-23520
Debian:14ruby-rails-html-sanitizer1.4.4-1DEBIAN-CVE-2022-23520
RubyGemsrails-html-sanitizer1.4.4GHSA-rrfc-7g8p-99q8
Ubuntu:22.04:LTSruby-rails-html-sanitizerno fix listedUBUNTU-CVE-2022-23520
Ubuntu:24.04:LTSruby-rails-html-sanitizerno fix listedUBUNTU-CVE-2022-23520
Ubuntu:25.10ruby-rails-html-sanitizerno fix listedUBUNTU-CVE-2022-23520
Ubuntu:26.04:LTSruby-rails-html-sanitizerno fix listedUBUNTU-CVE-2022-23520
Ubuntu:26.10ruby-rails-html-sanitizerno fix listedUBUNTU-CVE-2022-23520

Affected products (as reported)

VendorProductVersions
rails rails-html-sanitizer < 1.4.4

Weakness: CWE-79 · Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

References