GHSA-mm7x-qfjj-5g2c: Ammonia Cross-Site Scripting Vulnerability
LOWGHSA-mm7x-qfjj-5g2c is a LOW cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Ammonia libraries in the crates.io ecosystem. The issue involves ammonia incorrectly handles embedded svg and mathml leading to mutation xss after removal. Remediation is available by upgrading affected packages to version 4.1.2, 4.0.1, 3.3.1.
GHSA-mm7x-qfjj-5g2c at a Glance
How to Fix GHSA-mm7x-qfjj-5g2c
To remediate this vulnerability, upgrade all affected Ammonia dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade ammonia to 4.1.2
Upgrade ammonia to 4.0.1
Upgrade ammonia to 3.3.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for ammonia
How to Check if You Are Affected
To determine whether your application is affected by GHSA-mm7x-qfjj-5g2c, inspect your project dependencies for Ammonia:
inspect dependencies for ammonia
Analyze the terminal output to locate any version of Ammonia in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.1.2), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Ammonia, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
GHSA-mm7x-qfjj-5g2c Affected Ammonia Versions
3 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
ammonia
|
crates.io |
≥ 4.1.0
< 4.1.2
|
4.1.2
|
|
ammonia
|
crates.io |
≥ 4.0.0
< 4.0.1
|
4.0.1
|
|
ammonia
|
crates.io |
< 3.3.1
|
3.3.1
|
References
Frequently Asked Questions
What is GHSA-mm7x-qfjj-5g2c?
Which Ammonia versions are affected?
What version fixes GHSA-mm7x-qfjj-5g2c?
Is ammonia affected?
What CWE is associated with GHSA-mm7x-qfjj-5g2c?
How can I check crates.io dependencies for GHSA-mm7x-qfjj-5g2c?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-mm7x-qfjj-5g2c",
"modified" : "2025-09-22T15:40:15Z",
"published" : "2025-09-22T15:40:15Z",
"aliases" : [ ],
"summary" : "Ammonia incorrectly handles embedded SVG and MathML leading to mutation XSS after removal",
"details" : "Affected versions of this crate did not correctly strip namespace-incompatible tags\nin certain situations, causing it to incorrectly account for differences between HTML,\nSVG, and MathML.\n\nThis vulnerability only has an effect when the `svg` or `math` tag is allowed,\nbecause it relies on a tag being parsed as html during the cleaning process, but\nserialized in a way that causes in to be parsed as xml by the browser.\n\nAdditionally, the application using this library must allow a tag that is parsed as raw text in HTML.\nThese [elements] are:\n\n* title\n* textarea\n* xmp\n* iframe\n* noembed\n* noframes\n* plaintext\n* noscript\n* style\n* script\n\nApplications that do not explicitly allow any of these tags should not be affected, since none are allowed by default.\n\n[elements]: https://github.com/servo/html5ever/blob/57eb334c0ffccc6f88d563419f0fbeef6ff5741c/html5ever/src/tree_builder/rules.rs",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N/E:U"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "crates.io",
"name" : "ammonia"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.1.0"
}, {
"fixed" : "4.1.2"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "ammonia"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.0.0"
}, {
"fixed" : "4.0.1"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "ammonia"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "3.3.1"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/rust-ammonia/ammonia/commit/de0297111a3a1273275b670960bcd47a0481718e"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/rust-ammonia/ammonia"
}, {
"type" : "WEB",
"url" : "https://rustsec.org/advisories/RUSTSEC-2025-0071.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "LOW",
"github_reviewed" : true,
"github_reviewed_at" : "2025-09-22T15:40:15Z",
"nvd_published_at" : null
}
}