RUSTSEC-2021-0157
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:
```html <div style='background:url("cid:\");EVIL_CSS_HERE;background:url(\"cid:")'> ```
Would erroneously "sanitize" to:
```html <div style='background:url("cid:");EVIL_CSS_HERE;background:url("cid:")'> ```
---
This vulnerability was reported by Uttej Badwane
Are you affected?
Enter the version of the package you're using.
Affected packages
0.0.0-0Fixed in: 4.1.7Upgrade ammonia to 4.1.7 or newer (ecosystem crates.io).
References
Check it before you install it
One call answers whether to add this package: known advisories, CISA KEV, and whether the name is a hallucinated or freshly squatted one. No key needed to try it.
curl -s https://vdb.ai.kr/v1/ai/check-packages \
-H 'Content-Type: application/json' \
-d '{"packages":["pkg:cargo/ammonia"]}'