GHSA-mm7x-qfjj-5g2c Incorrect handling of embedded SVG and MathML leads to mutation XSS after removal
Attackers can execute arbitrary JavaScript via mutation XSS if the application explicitly allows SVG, MathML, and specific raw-text HTML tags.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is GHSA-mm7x-qfjj-5g2c?
GHSA-mm7x-qfjj-5g2c is a cross-site scripting vulnerability in ammonia, published on 21 Sep 2025. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Official description
Affected versions of this crate did not correctly strip namespace-incompatible tags in certain situations, causing it to incorrectly account for differences between HTML, SVG, and MathML.
This vulnerability only has an effect when the svg or math tag is allowed,
because it relies on a tag being parsed as html during the cleaning process, but
serialized in a way that causes in to be parsed as xml by the browser.
Additionally, 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.
Which versions are affected by GHSA-mm7x-qfjj-5g2c?
7 open source packages ship an affected version, including ammonia.
| Package | Affected | Fixed in |
|---|---|---|
ammonia crates.io | All versions | 3.3.1 |
ammonia crates.io | All versions | 3.3.1 |
ammonia crates.io | From 0.0.0-0 | 3.3.1, 4.0.1, 4.1.2 |
ammonia crates.io | From 4.0.0 | 4.0.1 |
ammonia crates.io | From 4.0.0 | 4.0.1 |
ammonia crates.io | From 4.1.0 | 4.1.2 |
1 more packages
ammonia crates.io | From 4.1.0 | 4.1.2 |
How do I fix GHSA-mm7x-qfjj-5g2c?
Upgrade ammonia to a fixed version for your release line: 3.3.1, 4.0.1 or 4.1.2.
Escape output for the context it lands in and set a strict Content Security Policy. Upgrading the affected component is the real fix. More about Cross-site scripting.
Is GHSA-mm7x-qfjj-5g2c being exploited?
There is no known exploitation of GHSA-mm7x-qfjj-5g2c in the wild and no public exploit code.
Sources
Also known as RUSTSEC-2025-0071.