Cross-site Scripting in Sanitize
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- None
- Attack complexity
- Low
- Impact type
- Cross-site scripting
- Confidentiality · integrity · availability
- Low · Low · Low
- Fix status
- Fixed
Attack profile from CVSS 3.1 · CNA. Fix status from CNA and GitHub. Impact type from CWE-79.
Summary
In Sanitize (RubyGem sanitize) greater than or equal to 3.0.0 and less than 5.2.1, there is a cross-site scripting vulnerability. When HTML is sanitized using Sanitize's "relaxed" config, or a custom config that allows certain elements, some content in a math or svg element may not be sanitized correctly even if math and svg are not in the allowlist. You are likely to be vulnerable to this issue if you use Sanitize's relaxed config or a custom config that allows one or more of the following HTML elements: iframe, math, noembed, noframes, noscript, plaintext, script, style, svg, xmp. Using carefully crafted input, an attacker may be able to sneak arbitrary HTML through Sanitize, potentially resulting in XSS (cross-site scripting) or other undesired behavior when that HTML is rendered in a browser. This has been fixed in 5.2.1.
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 |
|---|---|---|---|---|---|
| rgrove | Sanitize | 3.0.0 to before 5.2.1 | 5.2.1 | Patch available | CNA |
| — | sanitize (RubyGems) | 3.0.0 to before 5.2.1 | 5.2.1 | Patch available | GHSA-p4x4-rw2p-8j8m |
- Sanitize Vendorrgrove Affected 3.0.0 to before 5.2.1 Fixed in 5.2.1 Patch available CNA
- sanitize (RubyGems) Vendor— Affected 3.0.0 to before 5.2.1 Fixed in 5.2.1 Patch available GHSA-p4x4-rw2p-8j8m
Remediation
- Fix · CNA Sanitize (rgrove) Fixed in 5.2.1
- Fix · GHSA-p4x4-rw2p-8j8m sanitize (RubyGems) Fixed in 5.2.1 Advisory →
Vendor assessments
Timeline
- 2026-10-02 Threatist record created from CVE-2020-4054
- 2026-10-03 Alias added: GHSA-p4x4-rw2p-8j8m
References
Advisory 5
More rgrove Sanitize vulnerabilities
- TI-2018-02737 Cross-site scripting in Ryan Grove sanitize CVSS 3.0HIGH 7.5
- TI-2023-18617 Sanitize vulnerable to Cross-site Scripting via insufficient neutralization of `style` element content CVSS 3.1HIGH 7.1
- TI-2023-09456 Sanitize vulnerable to Cross-site Scripting via Improper neutralization of `noscript` element CVSS 3.1MEDIUM 6.1
Sources
- CVE-2020-4054 · CVE Program
- CVE-2020-4054 · NVD
- FIRST EPSS
- GHSA-p4x4-rw2p-8j8m · GitHub Advisory Database · CC BY 4.0
- CVE-2020-4054 · 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