CVE-2022-23520
rubygem-rails-html-sanitizer: Cross site scripting vulnerability with certain configurations
Overview
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.
Source: OX vulnerability database
Severity
6.1 · MEDIUM
CVSS 3.1 base score, scored by NVD.
- Attack vector
- Network
- Attack complexity
- Low
- Privileges required
- None
- User interaction
- Required
- Scope
- Changed
- Confidentiality
- Low
- Integrity
- Low
- Availability
- None
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Weakness: CWE-79
Affected packages · 1
| Ecosystem | Package | Vulnerable | Fixed in |
|---|---|---|---|
| RubyGems | rails-html-sanitizer | <1.4.4 | 1.4.4 |
Open a package to see all its vulnerabilities.
Operating systems · 15 fixes
Red Hat 1 release · 1 package
| Release | Package | Fixed in |
|---|---|---|
| 7 | tfm-rubygem-rails-html-sanitizer | affected |
SUSE Linux Enterprise 2 releases · 1 package
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| 15.4 | ruby2-5-rubygem-rails-html-sanitizer | 1.0.4-150000.4.6.1 | SUSE-SU-2023:3714-1 |
| 15.5 | ruby2-5-rubygem-rails-html-sanitizer | 1.0.4-150000.4.6.1 | SUSE-SU-2023:3714-1 |
debian 5 releases · 1 package
| Release | Package | Fixed in |
|---|---|---|
| 10 | ruby-rails-html-sanitizer | 1.0.4-1+deb10u2 |
| 11 | ruby-rails-html-sanitizer | 1.3.0-1+deb11u1 |
| 12 | ruby-rails-html-sanitizer | 1.4.4-1 |
| 13 | ruby-rails-html-sanitizer | 1.4.4-1 |
| 14 | ruby-rails-html-sanitizer | 1.4.4-1 |
echo 1 release · 1 package
| Release | Package | Fixed in |
|---|---|---|
| ruby-rails-html-sanitizer | 1.4.4-1 |
openSUSE 1 release · 4 packages
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Tumbleweed | ruby3-1-rubygem-rails-html-sanitizer +1 | 1.5.0-1.1 | openSUSE-SU-2024:12769-1 |
| Tumbleweed | ruby3-3-rubygem-rails-html-sanitizer | 1.6.0-1.5 | openSUSE-SU-2024:14175-1 |
| Tumbleweed | ruby3-4-rubygem-rails-html-sanitizer | 1.6.0-1.7 | openSUSE-SU-2025:15125-1 |
| Tumbleweed | ruby4-0-rubygem-rails-html-sanitizer | 1.6.0-1.9 | openSUSE-SU-2026:10361-1 |
seal Red Hat 2 releases · 2 packages
| Release | Package | Fixed in |
|---|---|---|
| 7 | python-jinja2 +1 | 2.7.2-4.el7+sp999 |
| 8 | libsolv +1 | 0.7.20-6.el8+sp999 |
References
- access.redhat.com https://access.redhat.com/security/cve/CVE-2022-23520
- cwe.mitre.org https://cwe.mitre.org/data/definitions/79.html
- github.com https://github.com/rails/rails-html-sanitizer
- github.com https://github.com/rails/rails-html-sanitizer/security/advisories/GHSA-rrfc-7g8p-99q8
- github.com https://github.com/rubysec/ruby-advisory-db/blob/master/gems/rails-html-sanitizer/CVE-2022-23520.yml
- hackerone.com https://hackerone.com/reports/1654310
- lists.debian.org https://lists.debian.org/debian-lts-announce/2023/09/msg00012.html
- lists.debian.org https://lists.debian.org/debian-lts-announce/2024/09/msg00045.html
- nvd.nist.gov https://nvd.nist.gov/vuln/detail/CVE-2022-23520
- www.cve.org https://www.cve.org/CVERecord?id=CVE-2022-23520
OX Radar and Response Center
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.