Email me

Rust advisories / ammonia

Vulnerability MediumRUSTSEC-2022-0003 · ammonia

RUSTSEC-2022-0003: Space bug in `clean_text`

Short answerA security vulnerability in the ammonia crate: Space bug in `clean_text`. GitHub rates it Medium. Fixed in 3.1.3: update to a fixed version.

Crateammonia
TypeVulnerability (format-injection)
Affected versionsFrom 3.0.0 before 3.1.3.
Fixed in3.1.3
SeverityMedium (GitHub rating)
Published2022-01-19
Last changed2023-11-08
Also known asGHSA-p2g9-94wh-65c2
Affected functionsammonia::clean_text

What to do

  1. See which version you have: cargo tree -i ammonia (it also shows which of your dependencies pulls it in).
  2. Update within your version requirement: cargo update -p ammonia. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for example ammonia = "3.1.3") or update the dependency that pulls it in.
  3. Check again with cargo audit, or paste your Cargo.lock into our Cargo.toml checker.

Details from the advisory

An incorrect mapping from HTML specification to ASCII codes was used. Because HTML treats the Form Feed as whitespace, code like this has an injection bug:

let html = format!("<div title={}>", clean_text(user_supplied_string));

Applications are not affected if they quote their attributes, or if they don't use clean_text at all.

References

From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.

Other advisories for ammonia

Full security history of ammonia

Up next

Same crateammonia: security historyEvery advisory for this crate, and whether it is safe to use today.Read it next →

Did this answer your question?

Get the receipts by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Popular in the shop

All 124 tools →

Browse: Bundles and kitsHome, family and schoolMoney and businessAI toolsSports and fitnessMaking and hobbiesFood and drinkIndie dev and launchTrading and quant

Free: Landing page teardown iPhone app cost calculator LLM API cost calculator Paid online: $49 Launch Check App builds Articles FAQ