SEVERITY NOT PROVIDED

GHSA-934p-vp7m-gx3c: Incorrect handling of embedded SVG and MathML leads to mutation XSS

Published 2026-11-12 · Updated 2026-11-13 · Also known as RUSTSEC-2026-0533

Summary

Incorrect handling of embedded SVG and MathML in the ammonia crate can lead to mutation XSS due to parsing discrepancies between HTML and foreign XML. Engineering teams using ammonia must update to the fixed versions.

Who is affected

Affected deployments allow MathML text integration points or SVG foreignObject to contain tags in the other namespace without a root tag that switches out of the HTML namespace. Attackers can exploit parsing differences between HTML and foreign XML to inject arbitrary JavaScript code, provided the application allows specific raw text elements like title, textarea, xmp, iframe, noembed, noframes, plaintext, noscript, style, or script.

Exploitability

The CVSS vector, base score, and EPSS are not documented. CISA KEV active exploitation is no.

Remediation

How to check your project

Automated analysis of the published advisory data, generated 2026-11-19. Not human-reviewed; verify against the official advisory. How this works.

Affected packages

EcosystemPackageAffected versionsFixed inUpgrade
crates.io ammonia >= 0.0.0-0, < 3.3.5 3.3.5 cargo update -p ammonia --precise 3.3.5
crates.io ammonia >= 4.0.0, < 4.1.9 4.1.9 cargo update -p ammonia --precise 4.1.9
crates.io ammonia >= 4.2.0, < 4.2.5 4.2.5 cargo update -p ammonia --precise 4.2.5

FAQ

What packages are affected by this vulnerability?

The crates.io package ammonia is affected in version ranges introduced 0.0.0-0 and fixed in 3.3.5, introduced 4.0.0 and fixed in 4.1.9, and introduced 4.2.0 and fixed in 4.2.5.

Are applications using default settings affected?

Applications that do not explicitly allow any of the specified raw text tags should not be affected, since none are allowed by default.

Who reported the vulnerability?

The vulnerability was reported by Roger Meyer.

Original advisory description
The MathML text integration points (`mi`, `mo`, `mn`, `ms`, `mtext`) and SVG `foreignObject` can be made to contain a tag in the other one's namespace (a MathML integration point with a child in the SVG namespace, or vice versa) without the root tag that switches out of the HTML namespace. If the attacker can construct input that parses differently in as HTML than as foreign XML, they can inject arbitrary JavaScript code into the user's browser. For example: - The user writes `<math><mi><svg><gadget></svg></mi></math>`. - The application enables `math`, `mi`, and the gadget, but not `svg`. - Ammonia filters the input to `<math><mi><gadget></mi></math>`. - Because svg is now gone, the gadget switches from being parsed as SVG to being parsed as HTML. - The gadget is written in such a way that it exploits the parsing differences between HTML and MathML. As far as we know, the gadget can only be written using 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/a027c2835472d518893c906dc29c42200af3c960/html5ever/src/tree_builder/rules.rs --- This vulnerability was reported by Roger Meyer.

References

Source records: RUSTSEC-2026-0533 (OSV.dev).