Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-63430 Overview
CVE-2026-63430 is a mutation cross-site scripting (mXSS) vulnerability in ammonia, a Rust library for sanitizing untrusted HTML. The flaw affects versions prior to 3.3.2, 4.0.2, and 4.1.3. The sanitizer incorrectly handles the MathML annotation-xml integration point after attribute filtering removes the encoding attribute. This namespace mismatch allows the sanitizer and the browser to disagree on how to parse descendant elements, enabling JavaScript execution in the rendered output. The vulnerability only affects applications that explicitly permit the math tag, annotation-xml, and at least one raw-text HTML element while disallowing the encoding attribute. These tags are not enabled by default.
Critical Impact
Successful exploitation permits attacker-controlled JavaScript execution in users' browsers through sanitized HTML output, enabling session theft, defacement, and client-side attacks.
Affected Products
- ammonia Rust crate versions prior to 3.3.2 on the 3.x branch
- ammonia Rust crate versions prior to 4.0.2 on the 4.0.x branch
- ammonia Rust crate versions prior to 4.1.3 on the 4.1.x branch
Discovery Timeline
- 2026-10-15 - CVE-2026-63430 published to NVD
- 2026-10-16 - Last updated in NVD database
Technical Details for CVE-2026-63430
Vulnerability Analysis
The vulnerability is a mutation cross-site scripting (mXSS) issue classified under CWE-79. The root defect is an ordering problem: ammonia applies attribute filtering before evaluating MathML integration-point semantics. When an application configures ammonia to allow the math and annotation-xml elements but strip the encoding attribute, the sanitizer evaluates descendant nodes as if they remain inside the MathML namespace. When a browser later parses the same output, the absence of encoding causes it to treat annotation-xml as an HTML integration point, reparsing descendants under the HTML namespace. An attacker who places an allowed raw-text HTML element (such as a tag that triggers RAWTEXT parsing) inside the mismatched tree can smuggle executable script past the sanitizer. Full technical analysis is documented in the ammonia mXSS blog post and RustSec Advisory RUSTSEC-2026-0193.
Root Cause
The sanitizer does not re-evaluate MathML integration-point behavior after attribute filtering mutates the element. The annotation-xml element's namespace semantics depend on its encoding attribute. Removing that attribute changes the parsing context in the browser but not in ammonia, producing a verifier/parser discrepancy.
Attack Vector
Exploitation requires network-delivered HTML submitted to an application that uses a non-default ammonia configuration. The attacker supplies crafted markup containing nested math, annotation-xml, and an allowed raw-text HTML element. The payload passes sanitization and executes script when rendered in the victim's browser.
No synthetic exploit code is reproduced here. See the GitHub Security Advisory GHSA-9jh8-v38h-cvhr and the researcher's write-up for payload structure.
Detection Methods for CVE-2026-63430
Indicators of Compromise
- Inbound HTML content containing nested <math> and <annotation-xml> elements combined with raw-text HTML tags such as <style>, <script>, <xmp>, or <noembed>.
- Sanitized output in stored content fields that still contains executable script constructs after passing through ammonia.
- Application logs showing POST or PUT requests to user-content endpoints with payloads referencing MathML namespaces.
Detection Strategies
- Audit application dependencies for ammonia versions below 3.3.2, 4.0.2, or 4.1.3 using cargo tree or cargo audit.
- Inspect ammonia::Builder configurations in source code for custom tag allowlists that include math, annotation-xml, and raw-text HTML elements while disallowing the encoding attribute.
- Add parser-based differential testing that compares ammonia output against a browser DOM parse to surface namespace mismatches.
Monitoring Recommendations
- Monitor Web Application Firewall (WAF) logs for request bodies containing annotation-xml tokens.
- Enable Content Security Policy (CSP) violation reporting to capture inline script execution originating from user-generated content.
- Track cargo audit output in CI pipelines against RustSec Advisory RUSTSEC-2026-0193.
How to Mitigate CVE-2026-63430
Immediate Actions Required
- Upgrade ammonia to version 3.3.2, 4.0.2, or 4.1.3 depending on the branch currently deployed.
- Review all ammonia::Builder instances and remove math and annotation-xml from tags() allowlists unless strictly required.
- Rebuild and redeploy any Rust binaries or WebAssembly artifacts that statically link the vulnerable crate.
Patch Information
The maintainers released fixes in v3.3.2, v4.0.2, and v4.1.3. The patch commits are tracked in commit 7ac3fd3, commit 004bf2c, and commit b51bf4f, with changes landed in pull requests #243, #244, and #245.
Workarounds
- Remove math and annotation-xml from the sanitizer's allowed tag set if upgrading cannot be performed immediately.
- Alternatively, keep encoding in the allowed attribute set for annotation-xml so namespace semantics remain consistent between sanitizer and browser.
- Enforce a strict Content Security Policy that disallows inline scripts to reduce mXSS impact.
[package]
name = "ammonia"
-version = "4.1.2"
+version = "4.1.3"
authors = ["Michael Howell <michael@notriddle.com>"]
description = "HTML Sanitization"
keywords = [ "sanitization", "html", "security", "xss" ]
# Source: https://github.com/rust-ammonia/ammonia/commit/b51bf4f9749ed3cd518330105f20a2c39c9ee274
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

