Search
Find a vulnerability
Search criteria
Related vulnerabilities
RUSTSEC-2021-0157 (GHSA-69V2-W9VG-4G83)
Vulnerability from osv_rustsec – Published: 2021-10-10 12:00 – Updated: 2026-10-12 18:05 – Source website
VLAI
Summary
Incorrect escaping for `url("")` functions in CSS style attributes
Details
In some cases, quotation marks in CSS url() functions are not escaped. This allows CSS injection. This feature is not enabled by default, so an application is vulnerable if, and only if, the style attribute is allowed and filter_style_properties is used.
As an example, this snippet:
<div style='background:url("cid:\");EVIL_CSS_HERE;background:url(\"cid:")'>
Would erroneously "sanitize" to:
<div style='background:url("cid:");EVIL_CSS_HERE;background:url("cid:")'>
This vulnerability was reported by Uttej Badwane
Aliases
References
3 references
{
"affected": [
{
"database_specific": {
"categories": [
"format-injection"
],
"cvss": null,
"informational": null
},
"ecosystem_specific": {
"affected_functions": null,
"affects": {
"arch": [],
"functions": [],
"os": []
}
},
"package": {
"ecosystem": "crates.io",
"name": "ammonia",
"purl": "pkg:cargo/ammonia"
},
"ranges": [
{
"events": [
{
"introduced": "0.0.0-0"
},
{
"fixed": "4.1.7"
},
{
"introduced": "4.2.0"
},
{
"fixed": "4.2.3"
}
],
"type": "SEMVER"
}
],
"versions": []
}
],
"aliases": [
"GHSA-69v2-w9vg-4g83"
],
"database_specific": {
"license": "CC0-1.0"
},
"details": "In some cases, quotation marks in CSS url() functions are not escaped. This allows CSS injection. This feature is not enabled by default, so an application is vulnerable if, and only if, the style attribute is allowed and filter_style_properties is used.\n\nAs an example, this snippet:\n\n```html\n\u003cdiv style=\u0027background:url(\"cid:\\\");EVIL_CSS_HERE;background:url(\\\"cid:\")\u0027\u003e\n```\n\nWould erroneously \"sanitize\" to:\n\n```html\n\u003cdiv style=\u0027background:url(\"cid:\");EVIL_CSS_HERE;background:url(\"cid:\")\u0027\u003e\n```\n\n---\n\nThis vulnerability was reported by Uttej Badwane",
"id": "RUSTSEC-2021-0157",
"modified": "2026-10-12T18:05:20Z",
"published": "2021-10-10T12:00:00Z",
"references": [
{
"type": "PACKAGE",
"url": "https://crates.io/crates/ammonia"
},
{
"type": "ADVISORY",
"url": "https://rustsec.org/advisories/RUSTSEC-2021-0157.html"
},
{
"type": "WEB",
"url": "https://github.com/rust-ammonia/ammonia/pull/259"
}
],
"related": [],
"severity": [],
"summary": "Incorrect escaping for `url(\"\")` functions in CSS style attributes"
}