Cross-site scripting in https://github.com/rails/rails-html-sanitizer
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- Required
- Attack complexity
- Low
- Impact type
- Cross-site scripting
- Confidentiality · integrity · availability
- Low · Low · None
- Fix status
- Fixed
Attack profile from CVSS 3.1 · NVD. Fix status from CNA, GitHub and Red Hat. Impact type from CWE-79.
Summary
# Possible XSS Vulnerability in Rails::Html::SanitizerThere is a possible XSS vulnerability with certain configurations of Rails::Html::Sanitizer.This vulnerability has been assigned the CVE identifier CVE-2022-32209.Versions Affected: ALLNot affected: NONEFixed Versions: v1.4.3## ImpactA possible XSS vulnerability with certain configurations of 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 may be done via application configuration:```ruby# In config/application.rbconfig.action_view.sanitized_allowed_tags = ["select", "style"]```see https://guides.rubyonrails.org/configuring.html#configuring-action-viewOr it may be done with a `:tags` option to the Action View helper `sanitize`:```<%= sanitize @comment.body, tags: ["select", "style"] %>```see https://api.rubyonrails.org/classes/ActionView/Helpers/SanitizeHelper.html#method-i-sanitizeOr it may be done with Rails::Html::SafeListSanitizer directly:```ruby# class-level optionRails::Html::SafeListSanitizer.allowed_tags = ["select", "style"]```or```ruby# instance-level optionRails::Html::SafeListSanitizer.new.sanitize(@article.body, tags: ["select", "style"])```All users overriding the allowed tags by any of the above mechanisms to include both "select" and "style" should either upgrade or use one of the workarounds immediately.## ReleasesThe FIXED releases are available at the normal locations.## WorkaroundsRemove either `select` or `style` from the overridden allowed tags.## CreditsThis vulnerability was responsibly reported by [windshock](https://hackerone.com/windshock?type=user).
Why it matters now
SSVC decision points
Not available: CISA has not published SSVC decision points for this record.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| — | https://github.com/rails/rails-html-sanitizer | v1.4.3 | — | No fix listed | CNA |
| — | rails-html-sanitizer (RubyGems) | before 1.4.3 | 1.4.3 | Patch available | GHSA-pg8v-g4xq-hww9 |
- https://github.com/rails/rails-html-sanitizer Vendor— Affected v1.4.3 Fixed in — No fix listed CNA
- rails-html-sanitizer (RubyGems) Vendor— Affected before 1.4.3 Fixed in 1.4.3 Patch available GHSA-pg8v-g4xq-hww9
CPE configurations NVD · 4
| CPE | Versions | Role | Vendor |
|---|---|---|---|
| cpe:2.3:a:rubyonrails:rails_html_sanitizers:*:*:*:*:*:rails:*:* | before 1.4.3 | Vulnerable | Rails |
| cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:* | 35 | Vulnerable | Fedoraproject |
| cpe:2.3:o:fedoraproject:fedora:36:*:*:*:*:*:*:* | 36 | Vulnerable | Fedoraproject |
| cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:* | 10.0 | Vulnerable | Debian |
- cpe:2.3:a:rubyonrails:rails_html_sanitizers:*:*:*:*:*:rails:*:* Versions before 1.4.3 Vulnerable ·Rails
- cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:* Versions 35 Vulnerable ·Fedoraproject
- cpe:2.3:o:fedoraproject:fedora:36:*:*:*:*:*:*:* Versions 36 Vulnerable ·Fedoraproject
- cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:* Versions 10.0 Vulnerable ·Debian
Remediation
- Fix · GHSA-pg8v-g4xq-hww9 rails-html-sanitizer (RubyGems) Fixed in 1.4.3 Advisory →
Red Hat 1 advisory
- RHSA-2022:8506 Released 2022-11-16 · Red Hat rating ImportantSatellite 6.12 Release
- Red Hat Satellite 6.12 for RHEL 8 candlepin-4.1.15-1.el8sat, candlepin-selinux-4.1.15-1.el8sat, foreman-3.3.0.17-1.el8sat +19
Vendor assessments
Red Hat
Red Hat rating: Important. Red Hat's page for this CVE →
| Product | Status | Plan or fix |
|---|---|---|
| Red Hat Satellite 6.12 for RHEL 8 | Fixed | RHSA-2022:8506 |
Not affected: 1 product
- Red Hat Satellite 6.12 for RHEL 8
Timeline
- 2026-10-02 Threatist record created from CVE-2022-32209
- 2026-10-03 Alias added: GHSA-pg8v-g4xq-hww9
References
Advisory 4
Other 9
- https://github.com/rails/rails-html-sanitizer/commit/45a5c10fed3d9aa141594c80afa06d748fa0967d
- https://github.com/rails/rails-html-sanitizer
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/rails-html-sanitizer/CVE-2022-32209.yml
- https://groups.google.com/g/rubyonrails-security/c/ce9PhUANQ6s
- https://lists.debian.org/debian-lts-announce/2024/09/msg00045.html
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/AGRLWBEB3S5AU3D4TTROIS7O6QPHDTRH
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/NHDACMCLWE32BZZTSNWQPIFUAD5I6Q47
- https://lists.fedoraproject.org/archives/list/[email protected]/message/AGRLWBEB3S5AU3D4TTROIS7O6QPHDTRH
- https://lists.fedoraproject.org/archives/list/[email protected]/message/NHDACMCLWE32BZZTSNWQPIFUAD5I6Q47
Sources
- CVE-2022-32209 · CVE Program
- CVE-2022-32209 · NVD
- FIRST EPSS
- GHSA-pg8v-g4xq-hww9 · GitHub Advisory Database · CC BY 4.0
- CVE-2022-32209 · Red Hat security data · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences