# CVE-2020-4054: Cross-site Scripting in Sanitize

- Severity: High 7.3 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 1.92%, higher than 80% of CVEs (2026-12-01)
- Published: 2020-06-16T22:08:06.000Z
- Modified: 2026-07-08T06:29:13.144Z
- Also known as: GHSA-p4x4-rw2p-8j8m
- Weaknesses: CWE-79
- Assigned by: GitHub_M

## Description

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.

(As written by CVE List.)

## Affected

- rgrove Sanitize: >= 3.0.0, < 5.2.1
- sanitize (RubyGems): from 3.0.0 before 5.2.1
- sanitize_project sanitize: from 3.0.0 before 5.2.1

## Every score

- GitHub_M: CVSS:3.1 7.3 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L`
- GitHub: CVSS:3.1 7.3 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L`
- NVD: CVSS:3.1 7.3 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L`
- NVD: CVSS:2.0 6.8 Medium `AV:N/AC:M/Au:N/C:P/I:P/A:P`

## References

- <https://github.com/rgrove/sanitize/security/advisories/GHSA-p4x4-rw2p-8j8m> (third-party-advisory, web)
- <https://github.com/rgrove/sanitize/commit/a11498de9e283cd457b35ee252983662f7452aa9> (patch, third-party-advisory, web)
- <https://github.com/rgrove/sanitize/releases/tag/v5.2.1> (release-notes, third-party-advisory, web)
- <https://www.debian.org/security/2020/dsa-4730> (vendor-advisory, web)
- <https://usn.ubuntu.com/4543-1/> (vendor-advisory)
- <https://nvd.nist.gov/vuln/detail/CVE-2020-4054> (advisory)
- <https://github.com/rgrove/sanitize> (package)
- <https://github.com/rubysec/ruby-advisory-db/blob/master/gems/sanitize/CVE-2020-4054.yml> (web)
- <https://usn.ubuntu.com/4543-1> (web)

## Sources

- CVE List: [CVE-2020-4054](https://www.cve.org/CVERecord?id=CVE-2020-4054), CVE Terms of Use, modified 2024-08-04
- GitHub Advisory Database: [GHSA-p4x4-rw2p-8j8m](https://github.com/advisories/GHSA-p4x4-rw2p-8j8m), CC-BY-4.0, modified 2026-07-08
- NVD: [CVE-2020-4054](https://nvd.nist.gov/vuln/detail/CVE-2020-4054), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2020-4054 · Whole record: https://cve.day/CVE-2020-4054.json · Rebuilt by cve.day 2026-11-25T22:57:52.990Z
