Track vulnerabilities like this one.
Sign up free to get alerted when software you use is affected.
6.1
CVE-2022-23520: rails-html-sanitizer could allow injected content
CVE-2022-23520 · published 3 years ago
Summary
If a Rails application changes the list of tags that the sanitizer accepts and includes both the "select" and "style" tags, an attacker could insert harmful code into web pages. This risk is fixed in version 1.4.4 of rails-html-sanitizer. Update to the newer version or remove either the "select" or "style" tag from the custom list to stay safe.
What to do
- Update rafael mendonça frança rails-html-sanitizer to version 1.4.4.
- Update debian ruby-rails-html-sanitizer to version 1.4.4-1.
- Update rubyonrails rails_html_sanitizers to version 1.4.4 or later.
Affected software
| Ecosystem | Vendor | Product | Affected versions |
|---|---|---|---|
| rubygems | rafael mendonça frança | rails-html-sanitizer |
< 1.4.4 Fix: upgrade to 1.4.4
|
| – | rubyonrails | rails_html_sanitizers |
< 1.4.4 cpe:2.3:a:rubyonrails:rails_html_sanitizers:*:*:*:*:*:rails:*:* |
| – | debian | debian_linux |
10.0 cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:* |
| Ubuntu:16.04:LTS | canonical | ruby-rails-html-sanitizer | All versions |
| Debian:12 | debian | ruby-rails-html-sanitizer |
< 1.4.4-1 Fix: upgrade to 1.4.4-1
|
Original advisory text
rails-html-sanitizer contains an incomplete fix for an XSS vulnerability
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.
References
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/rails-html-sanitize...
- https://github.com/advisories/GHSA-rrfc-7g8p-99q8
- https://lists.debian.org/debian-lts-announce/2023/09/msg00012.html URL
- https://lists.debian.org/debian-lts-announce/2024/09/msg00045.html URL
- https://nvd.nist.gov/vuln/detail/CVE-2022-23520 Vendor Advisory
- https://github.com/rails/rails-html-sanitizer/security/advisories/GHSA-rrfc-7g8p... Third Party Advisory
- https://hackerone.com/reports/1654310 Third Party Advisory
- https://ubuntu.com/security/CVE-2022-23520 Third Party Advisory
- https://www.cve.org/CVERecord?id=CVE-2022-23520 Third Party Advisory
- https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/23xxx/CVE-2022-23520... Vendor Advisory
- https://security-tracker.debian.org/tracker/CVE-2022-23520 Vendor Advisory
Internet-facing
60 days
Internal
At next upgrade
- Not known to be exploited
- Needs hands-on effort to exploit (estimated)
- Gives an attacker partial control (estimated)
Type
CWE-79Cross-site Scripting (XSS)
Timeline
Published14 Dec 2022
Updated4 Nov 2026
First seen6 Mar 2026
Sources
GHSA-rrfc-7g8p-99q8 · GHSA
CVE-2022-23520 · NVD
UBUNTU-CVE-2022-23520 · OSV
CVE-2022-23520 · OSV
DEBIAN-CVE-2022-23520 · OSV
Track software like this
Free during beta