Advisory

GHSA-mm7x-qfjj-5g2c

Also known as: RUSTSEC-2025-0071

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
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.

[elements]: https://github.com/servo/html5ever/blob/57eb334c0ffccc6f88d563419f0fbeef6ff5741c/html5ever/src/tree_builder/rules.rs

Severity

Low Basis: The source's own band: LOW

Dates

Published
2025-09-22 15:40 UTC
Modified
2026-09-10 03:50 UTC

Affected packages and fixes

ammonia

crates.io · All systems

Affected

  • introduced 4.1.0, fixed 4.1.2 (semver)

Fixed versions

4.1.2

Fix

  • Fixed version 4.1.2
    cargo update -p ammonia --precise 4.1.2

ammonia

crates.io · All systems

Affected

  • introduced 4.0.0, fixed 4.0.1 (semver)

Fixed versions

4.0.1

Fix

  • Fixed version 4.0.1
    cargo update -p ammonia --precise 4.0.1

ammonia

crates.io · All systems

Affected

  • introduced 0, fixed 3.3.1 (semver)

Fixed versions

3.3.1

Fix

  • Fixed version 3.3.1
    cargo update -p ammonia --precise 3.3.1

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences