ammonia CSS url function case-sensitivity bypass

Severity: info · Published 2026-10-16

The ammonia HTML/CSS sanitization library fails to properly filter URLs in CSS when the url() function is written in uppercase (URL()). Applications that rely on ammonia to block unwanted URL schemes can be bypassed, allowing attackers to inject tracking pixels or other URLs that the application intended to block.

Technologies: ammonia (crates.io). Vendors: crates.io.

Quick answers

Is This vulnerability exploited in the wild?
No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.
How severe is This vulnerability?
Informational severity, published 16 October 2026.
Which products and versions are affected?
ammonia (crates.io) SEMVER:introduced=0.0.0-0,fixed=4.1.8,introduced=4.2.0,fixed=4.2.4; Rust-Ammonia Ammonia before 4.1.8, 4.2.0 to before 4.2.4.
Is there a fix for This vulnerability?
Yes. ammonia (crates.io): upgrade to 4.2.4 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is This vulnerability attacked?
It is attacked over the network.
Am I affected?
Check whether you run ammonia (crates.io) or Rust-Ammonia Ammonia at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • ammonia (crates.io): upgrade to 4.2.4 or later
    cargo update -p ammonia

Technical details

The vulnerability is a case-sensitivity bypass in CSS url() filtering. When ammonia sanitizes CSS, it matches the url() function case-sensitively instead of case-insensitively as per CSS specifications. An attacker can use URL() in uppercase to bypass URL scheme restrictions configured on the sanitizer, allowing disallowed schemes and domains to pass through unfiltered.

Affected products

  • rust-ammonia ammonia before 4.1.8, 4.2.0 to before 4.2.4

Identifiers

  • GHSA-x43w-36pp-96g3
  • RUSTSEC-2026-0373

Timeline

  • 2026-10-16: disclosed
  • 2026-10-17: patched

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.