CVE-2020-4054Cross-site Scripting in Sanitize
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.
What to do
Fixed builds are available from Debian, RubyGems, Ubuntu: see the table below for the fixed version per release.
Ubuntu has not shipped a fix for every release yet.
Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.
curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \ -H "Content-Type: text/plain" --data-binary @inventory.txt
Vendor status at a glance
Status by vendor and release
From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 26.04 | ruby-sanitize | Not affected vulnerable_code_not_present | ||
| Ubuntu 25.10 | ruby-sanitize | Not affected vulnerable_code_not_present | ||
| Ubuntu 24.04 | ruby-sanitize | Not affected vulnerable_code_not_present | ||
| Ubuntu 22.04 | ruby-sanitize | Not affected vulnerable_code_not_present | ||
| Ubuntu 20.04 | ruby-sanitize | Fixed | 4.6.6-2.1~0.20.04.1 | UBUNTU-CVE-2020-4054 |
| Ubuntu 18.04 | ruby-sanitize | Fix pending | UBUNTU-CVE-2020-4054 | |
| Ubuntu 16.04 | ruby-sanitize | Fix pending | UBUNTU-CVE-2020-4054 | |
| Debian 14 | ruby-sanitize | Fixed | 4.6.6-2.1 | DEBIAN-CVE-2020-4054 |
| Debian 13 | ruby-sanitize | Fixed | 4.6.6-2.1 | DEBIAN-CVE-2020-4054 |
| Debian 12 | ruby-sanitize | Fixed | 4.6.6-2.1 | DEBIAN-CVE-2020-4054 |
| RubyGems library | sanitize | Fixed | 5.2.1 | GHSA-p4x4-rw2p-8j8m |
What the vendor says
As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.
- rgrove Sanitize: affected: >= 3.0.0, < 5.2.1
Vendor advisories:
- https://www.debian.org/security/2020/dsa-4730 (vendor-advisory)
- https://usn.ubuntu.com/4543-1/ (vendor-advisory)
References
- https://github.com/rgrove/sanitize/security/advisories/GHSA-p4x4-rw2p-8j8m
- https://github.com/rgrove/sanitize/commit/a11498de9e283cd457b35ee252983662f7452aa9
- https://github.com/rgrove/sanitize/releases/tag/v5.2.1
- https://www.debian.org/security/2020/dsa-4730
- https://usn.ubuntu.com/4543-1/
About this page
Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.