# GHSA-p2g9-94wh-65c2: Space bug in `clean_text`

- Severity: Medium (rating, scored by GitHub)
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Published: 2022-01-19T12:00:00.000Z
- Modified: 2023-11-08T04:21:23.389Z
- Also known as: RUSTSEC-2022-0003
- Weaknesses: CWE-79

## Description

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.

(As written by GitHub Advisory Database.)

## Affected

- ammonia (crates.io): from 3.0.0 before 3.1.3

## References

- <https://github.com/rust-ammonia/ammonia/pull/147> (web)
- <https://github.com/rust-ammonia/ammonia/commit/6c7bf22907a75d1bbaed52e4f7dd9716f5e6f737> (web)
- <https://github.com/rust-ammonia/ammonia> (package)
- <https://rustsec.org/advisories/RUSTSEC-2022-0003.html> (advisory, web)
- <https://crates.io/crates/ammonia> (package)

## Sources

- GitHub Advisory Database: [GHSA-p2g9-94wh-65c2](https://github.com/advisories/GHSA-p2g9-94wh-65c2), CC-BY-4.0, modified 2023-11-08
- RustSec Advisory Database: [RUSTSEC-2022-0003](https://rustsec.org/advisories/RUSTSEC-2022-0003.html), CC0-1.0, modified 2023-11-08

---

Page: https://cve.day/GHSA-p2g9-94wh-65c2 · Whole record: https://cve.day/GHSA-p2g9-94wh-65c2.json · Rebuilt by cve.day 2026-11-25T22:56:43.089Z
