CVE-2020-4054 json
Cross-site Scripting in Sanitize
published 6y ago modified 4mo ago also GHSA-p4x4-rw2p-8j8m , EUVD-2020-0503
- cvss
- 7.3
- version 3.1, CNA
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 1.9%
- EPSS 1.9% chance of exploitation in 30 days, percentile 80%
- public exploits
- 0
- none known
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.
Patch / fix
- rubygems sanitize 5.2.1
- sanitize_project sanitize 5.2.1
- ruby-sanitize Debian 14, Debian 13, Debian 12 4.6.6-2.1
debian advisories DEBIAN-CVE-2020-4054
- ruby-sanitize Ubuntu 20.04 LTS 4.6.6-2.1~0.20.04.1
ubuntu advisories UBUNTU-CVE-2020-4054
Ubuntu security data © Canonical Ltd., from https://github.com/canonical/ubuntu-security-notices via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0
Is CVE-2020-4054 in your dependencies? Fencer shows which of your repositories are affected as soon as an advisory lands, and opens the fix as a pull request.
Check with FencerVendor advisories
What the vendors themselves say about their products: affected, fixed or not affected, and what to do.
red hat product security vex CVE-2020-4054 updated cvss 5.4
rubygem-rails-html-sanitizer: XSS via crafted input
-
Red Hat All currently supported Red Hat productsnot affected: vulnerable code not present
Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf
Exploit prediction
1.92% chance of exploitation in the next 30 days, higher than 80% of all scored CVEs (FIRST EPSS, 2026-11-09).
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| CNA | 3.1 | 7.3 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L |
| NVD | 3.1 | 7.3 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L |
| NVD | 2.0 | 6.8 | AV:N/AC:M/Au:N/C:P/I:P/A:P |
| GitHub | 3.1 | 7.3 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| rubygems | sanitize | >=3.0.0, <5.2.1 |
5.2.1 |
Affected products
- rgrove Sanitize
Classification
- Weakness
-
- CWE-79 Improper Neutralization of Input During Web Page Generation
References
-
github.com
/rgrove/sanitize/commit/a11498de9e283cd457b35ee252983662f7452aa9
web, patch, third-party-advisory
-
debian.org
/security/2020/dsa-4730
vendor-advisory, web
-
usn.ubuntu.com
/4543-1/
vendor-advisory
-
github.com
/rgrove/sanitize/security/advisories/GHSA-p4x4-rw2p-8j8m
web, third-party-advisory
-
github.com
/rgrove/sanitize/releases/tag/v5.2.1
web, release-notes, third-party-advisory
-
nvd.nist.gov
/vuln/detail/CVE-2020-4054
advisory
-
github.com
/rgrove/sanitize
package
-
github.com
/rubysec/ruby-advisory-db/blob/master/gems/sanitize/CVE-2020-4054.yml
web
-
usn.ubuntu.com
/4543-1
web
Sources
- CVE List CVE-2020-4054
- GitHub Advisory GHSA-p4x4-rw2p-8j8m
- NVD CVE-2020-4054
Fencer Intel keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.