RUSTSEC-2021-0074
Incorrect handling of embedded SVG and MathML leads to mutation XSS
Details
Affected versions of this crate did not account for namespace-related parsing differences between HTML, SVG, and MathML. Even if the `svg` and `math` elements are not allowed, the underlying HTML parser still treats them differently. Running cleanup without accounting for these differing namespaces resulted in an "impossible" DOM, which appeared "safe" when examining the DOM tree, but when serialized and deserialized, could be exploited to inject arbitrary markup.
To exploit this, the application using this library must allow a tag that is parsed as raw text in HTML. These [elements] are:
* title * textarea * xmp * iframe * noembed * noframes * plaintext * noscript * style * script
Applications that do not explicitly allow any of these tags should not be affected, since none are allowed by default.
[elements]: https://github.com/servo/html5ever/blob/57eb334c0ffccc6f88d563419f0fbeef6ff5741c/html5ever/src/tree_builder/rules.rs
Are you affected?
Enter the version of the package you're using.
Affected packages
0.0.0-0Fixed in: 2.1.3Upgrade ammonia to 2.1.3 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"]}'