Missing case-insensitive matching for CSS url function
URL filtering, such as relative URLs and URL scheme limits, is not always applied when CSS sanitization is used. When the inner URL is quoted, CSS `url("")` is matched case-sensitively, when it should be matched case-insensitively. As a result, while `url("")` gets the intended domain name filtering, `URL("")` does not. The following example shows how an application needs to be configured to trigger this bug. ```rust let mut builder = Builder::new(); // allow inline styles builder.filter_style_properties(hashset!["background-image"]); builder.add_generic_attributes(&["style"]); // notice that "http" URLs aren't allowed builder.url_schemes(["cid"].into()); // attacker-controlled, presumably let cleaned = builder.clean(r#""#); // this is the expected result assert_eq!(String::from(&cleaned), r#"ok "#); // this is the result that the vulnerable version actually gets assert_eq!(String::from(&cleaned), r#"ok "#); ``` This can be used to inject tracking pixels where the application intended to prevent them. It does not allow XSS, and its usefulness for data exfiltration is limited. --- This vulnerability was reported by [Louis Li](https://github.com/zhixuli0406).
- Products
- ammonia
- Affected versions
- Not specified
- Fixed versions
- 4.1.8, 4.2.4
- CVEs
- Not specified
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 31 Oct 2026, 03:47 UTC · Revision 1
Source evidence
Missing case-insensitive matching for CSS url function
core-osv · Original sourcePublished 16 Oct 2026, 12:00 UTC
URL filtering, such as relative URLs and URL scheme limits, is not always applied when CSS sanitization is used. When the inner URL is quoted, CSS `url("")` is matched case-sensitively, when it should be matched case-insensitively. As a result, while `url("")` gets the intended domain name filtering, `URL("")` does not. The following example shows how an application needs to be configured to trigger this bug. ```rust let mut builder = Builder::new(); // allow inline styles builder.filter_style_properties(hashset!["background-image"]); builder.add_generic_attributes(&["style"]); // notice that "http" URLs aren't allowed builder.url_schemes(["cid"].into()); // attacker-controlled, presumably let cleaned = builder.clean(r#""#); // this is the expected result assert_eq!(String::from(&cleaned), r#"ok "#); // this is the result that the vulnerable version actually gets assert_eq!(String::from(&cleaned), r#"ok "#); ``` This can be used to inject tracking pixels where the application intended to prevent them. It does not allow XSS, and its usefulness for data exfiltration is limited. --- This vulnerability was reported by [Louis Li](https://github.com/zhixuli0406).
osv:RUSTSEC-2026-0373
ammonia
Fixed versions: 4.1.8, 4.2.4
Complete source record
{
"id": "093a62156b884bf6bdf9bb115eb10970a8d451b62e06aefd6192d54be3fb59d5",
"url": "https://osv.dev/vulnerability/RUSTSEC-2026-0373",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "Missing case-insensitive matching for CSS url function",
"summary": "URL filtering, such as relative URLs and URL scheme limits, is not always applied when CSS sanitization is used. When the inner URL is quoted, CSS `url(\"\")` is matched case-sensitively, when it should be matched case-insensitively. As a result, while `url(\"\")` gets the intended domain name filtering, `URL(\"\")` does not. The following example shows how an application needs to be configured to trigger this bug. ```rust let mut builder = Builder::new(); // allow inline styles builder.filter_style_properties(hashset![\"background-image\"]); builder.add_generic_attributes(&[\"style\"]); // notice that \"http\" URLs aren't allowed builder.url_schemes([\"cid\"].into()); // attacker-controlled, presumably let cleaned = builder.clean(r#\"\"#); // this is the expected result assert_eq!(String::from(&cleaned), r#\"ok \"#); // this is the result that the vulnerable version actually gets assert_eq!(String::from(&cleaned), r#\"ok \"#); ``` This can be used to inject tracking pixels where the application intended to prevent them. It does not allow XSS, and its usefulness for data exfiltration is limited. --- This vulnerability was reported by [Louis Li](https://github.com/zhixuli0406).",
"evidence": "osv:RUSTSEC-2026-0373",
"products": [
{
"name": {
"value": "ammonia",
"evidence": "/affected/0/package/name"
},
"prerequisites": [],
"fixed_versions": [
{
"value": "4.1.8",
"evidence": "/affected/0/ranges"
},
{
"value": "4.2.4",
"evidence": "/affected/0/ranges"
}
],
"affected_versions": []
}
],
"severity": "unknown",
"structured": {
"id": "RUSTSEC-2026-0373",
"aliases": [
"GHSA-x43w-36pp-96g3",
"RUSTSEC-2026-0373"
],
"affected": [
{
"ranges": [
{
"type": "SEMVER",
"events": [
{
"introduced": "0.0.0-0"
},
{
"fixed": "4.1.8"
},
{
"introduced": "4.2.0"
},
{
"fixed": "4.2.4"
}
]
}
],
"package": {
"name": "ammonia",
"purl": "pkg:cargo/ammonia",
"ecosystem": "crates.io"
},
"database_specific": {
"cvss": null,
"source": "https://github.com/rustsec/advisory-db/blob/osv/crates/RUSTSEC-2026-0373.json",
"categories": [
"format-injection"
],
"informational": null
},
"ecosystem_specific": {
"affects": {
"os": [],
"arch": [],
"functions": []
},
"affected_functions": null
}
}
],
"modified": "2026-10-17T15:30:02.378211969Z",
"provider": "osv",
"references": [
"https://crates.io/crates/ammonia",
"https://rustsec.org/advisories/RUSTSEC-2026-0373.html",
"https://github.com/rust-ammonia/ammonia/pull/267"
],
"provider_metadata": {
"license": "CC0-1.0"
}
},
"related_cves": [],
"security_relevant": true,
"severity_evidence": null
},
"source_id": "core-osv",
"document_id": 362248,
"published_at": "2026-10-16T12:00:00+00:00"
}