CVE-2018-3741
rubygem-rails-html-sanitizer: non-whitelisted attributes are present in sanitized output when input with specially-crafted HTML fragments leading to XSS vulnerability
Overview
Description
There is a possible XSS vulnerability in all rails-html-sanitizer gem versions below 1.0.4 for Ruby. The gem allows non-whitelisted attributes to be present in sanitized output when input with specially-crafted HTML fragments, and these attributes can lead to an XSS attack on target applications. This issue is similar to CVE-2018-8048 in Loofah. All users running an affected release should either upgrade or use one of the workarounds immediately.
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.0.4 | 1.0.4 |
Open a package to see all its vulnerabilities.
Operating systems · 94 fixes
Red Hat 1 release · 82 packages
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| 7 | rh-ror42-rubygem-rails-html-sanitizer +3 | wont fix | — |
| 7 | rubygem-unf-ext +1 | 0:0.0.7.5-1.el7cf | RHSA-2019:0212 |
| 7 | rubygem-memory-buffer +1 | 0:0.1.0-2.el7cf | RHSA-2019:0212 |
| 7 | rubygem-net-telnet | 0:0.1.1-90.el7cf | RHSA-2019:0212 |
| 7 | bubblewrap | 0:0.1.7-1.el7 | RHSA-2019:0212 |
| 7 | python2-future | 0:0.16.0-1.el7cf | RHSA-2019:0212 |
76 more rows
debian 5 releases · 1 package
| Release | Package | Fixed in |
|---|---|---|
| 11 | ruby-rails-html-sanitizer | 1.0.4-1 |
| 12 | ruby-rails-html-sanitizer | 1.0.4-1 |
| 13 | ruby-rails-html-sanitizer | 1.0.4-1 |
| 14 | ruby-rails-html-sanitizer | 1.0.4-1 |
| 9 | ruby-rails-html-sanitizer | affected |
echo 1 release · 1 package
| Release | Package | Fixed in |
|---|---|---|
| ruby-rails-html-sanitizer | 1.0.4-1 |
openSUSE 1 release · 6 packages
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Tumbleweed | ruby2-7-rubygem-rails-html-sanitizer +1 | 1.4.2-1.2 | openSUSE-SU-2024:11349-1 |
| Tumbleweed | ruby3-1-rubygem-rails-html-sanitizer | 1.4.3-1.1 | openSUSE-SU-2024:12145-1 |
| Tumbleweed | ruby3-2-rubygem-rails-html-sanitizer | 1.5.0-2.1 | openSUSE-SU-2024:13137-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 |
References
- access.redhat.com https://access.redhat.com/security/cve/CVE-2018-3741
- github.com https://github.com/rails/rails-html-sanitizer
- github.com https://github.com/rails/rails-html-sanitizer/commit/f3ba1a839a35f2ba7f941c15e239a1cb379d56ae
- groups.google.com https://groups.google.com/d/msg/rubyonrails-security/tP7W3kLc5u4/uDy2Br7xBgAJ
- nvd.nist.gov https://nvd.nist.gov/vuln/detail/CVE-2018-3741
- www.cve.org https://www.cve.org/CVERecord?id=CVE-2018-3741
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.