Security advisory
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.
- Products
- Not specified
- Affected versions
- Not specified
- Fixed versions
- Not specified
- CVEs
- CVE-2020-4054
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 31 Oct 2026, 11:13 UTC · Revision 1
Source evidence
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.
osv:CVE-2020-4054
Complete source record
{
"id": "4d384a19c52809c64a657b6be13b3a9bc6666a4589ff672ec73a57cd5760c3a6",
"url": "https://osv.dev/vulnerability/CVE-2020-4054",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "CVE-2020-4054",
"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.",
"evidence": "osv:CVE-2020-4054",
"products": [],
"severity": "high",
"structured": {
"id": "CVE-2020-4054",
"aliases": [
"CVE-2020-4054",
"GHSA-p4x4-rw2p-8j8m"
],
"metrics": [
{
"type": "CVSS_V3",
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L"
}
],
"affected": [
{
"ranges": [
{
"repo": "https://github.com/rgrove/sanitize",
"type": "GIT",
"events": [
{
"introduced": "3b68765f21c7387fa6ee0d348a40f7d4d4e94f21"
},
{
"fixed": "773d1af976b0e67a966bd3676ebab4f037395699"
},
{
"fixed": "a11498de9e283cd457b35ee252983662f7452aa9"
}
],
"database_specific": {
"extracted_events": [
{
"cpe": "cpe:2.3:a:sanitize_project:sanitize:*:*:*:*:*:ruby:*:*",
"range": [
{
"introduced": "3.0.0"
},
{
"fixed": "5.2.1"
}
],
"source": "CPE_RANGE"
},
{
"range": [
{
"fixed": "a11498de9e283cd457b35ee252983662f7452aa9"
}
],
"source": "REFERENCES_COMMIT"
},
{
"range": [
{
"fixed": "773d1af976b0e67a966bd3676ebab4f037395699"
}
],
"source": "REFERENCES_TAG",
"original_tag": "v5.2.1"
}
]
}
}
],
"versions": [
"v5.2.0",
"v5.1.0",
"v5.0.0",
"v4.6.6",
"v4.6.5",
"v4.6.4",
"v4.6.3",
"v4.6.2",
"v4.6.1",
"v4.6.0",
"v4.5.0",
"v4.4.0",
"v4.3.0",
"v4.2.0",
"v4.1.0",
"v4.0.1",
"v4.0.0",
"v3.1.2",
"v3.1.1",
"v3.1.0",
"v3.0.2",
"v3.0.1",
"v3.0.0"
],
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2020-4054.json"
}
}
],
"modified": "2026-10-20T10:53:28.180798875Z",
"provider": "osv",
"references": [
"https://usn.ubuntu.com/4543-1/",
"https://github.com/rgrove/sanitize/releases/tag/v5.2.1",
"https://github.com/rgrove/sanitize/security/advisories/GHSA-p4x4-rw2p-8j8m",
"https://www.debian.org/security/2020/dsa-4730",
"https://github.com/rgrove/sanitize/commit/a11498de9e283cd457b35ee252983662f7452aa9"
],
"provider_metadata": {}
},
"related_cves": [
{
"value": "CVE-2020-4054",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 384333,
"published_at": "2020-06-16T22:15:10.693+00:00"
}