ammonia: mXSS in ammonia via MathML `annotation-xml` encoding strip
rust-ammonia ammonia
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| ammonia crates.io |
|
|
rust-ammonia ammonia
| Product | Affected | Fixed in |
|---|---|---|
| ammonia crates.io |
|
|
ammonia is a Rust library for repairing and securing untrusted HTML. Prior to 3.3.2, 4.0.2, and 4.1.3, applications that explicitly allow the math tag, annotation-xml, and at least one raw-text HTML element while disallowing the encoding attribute can permit mutation cross-site scripting. ammonia does not correctly implement annotation-xml's encoding-dependent MathML integration-point behavior after attribute filtering removes encoding, so the sanitizer validates a descendant under one namespace interpretation while the browser reparses the output under another. An attacker can use that namespace transition and an allowed raw-text HTML element to execute JavaScript when a user renders the sanitized output. The required tags are not enabled by default, so applications that do not explicitly allow them are not affected. This issue is fixed in versions 3.3.2, 4.0.2, and 4.1.3.
From the CVE record · GitHub_M
Applications using ammonia are vulnerable if they explicitly allow the math and annotation-xml tags and at least one raw-text HTML element while disallowing the encoding attribute. An attacker can craft HTML that executes JavaScript when a user renders the sanitized output. The required tags are not enabled by default.
Teams using the crates.io ammonia package should check versions before 3.3.2, from 4.0.0 to before 4.0.2, and from 4.1.0 to before 4.1.3.