{"id":"CVE-2026-63430","aliases":["CVE-2026-63430","GHSA-9jh8-v38h-cvhr","RUSTSEC-2026-0193"],"related":[],"kind":"vulnerability","state":"published","title":"ammonia: mXSS in ammonia via MathML `annotation-xml` encoding strip","summary":"ammonia is a Rust library for repairing and securing untrusted HTML. Prior to 3.3.2, 4.0.2, and 4.1.3, applications that explicitly allow the math tag, annotation-xml, and at least one raw-text HTML element while disallowing the encoding attribute can permit mutation cross-site scripting. ammonia does not correctly implement annotation-xml's encoding-dependent MathML integration-point behavior after attribute filtering removes encoding, so the sanitizer validates a descendant under one namespace interpretation while the browser reparses the output under another. An attacker can use that namespace transition and an allowed raw-text HTML element to execute JavaScript when a user renders the sanitized output. The required tags are not enabled by default, so applications that do not explicitly allow them are not affected. This issue is fixed in versions 3.3.2, 4.0.2, and 4.1.3.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"ammonia is a Rust library for repairing and securing untrusted HTML. Prior to 3.3.2, 4.0.2, and 4.1.3, applications that explicitly allow the math tag, annotation-xml, and at least one raw-text HTML element while disallowing the encoding attribute can permit mutation cross-site scripting. ammonia does not correctly implement annotation-xml's encoding-dependent MathML integration-point behavior after attribute filtering removes encoding, so the sanitizer validates a descendant under one namespace interpretation while the browser reparses the output under another. An attacker can use that namespace transition and an allowed raw-text HTML element to execute JavaScript when a user renders the sanitized output. The required tags are not enabled by default, so applications that do not explicitly allow them are not affected. This issue is fixed in versions 3.3.2, 4.0.2, and 4.1.3.","source":"cvelist"},{"lang":"en","text":"If a certain set of MathML tags are enabled, an attacker can inject arbitrary JavaScript code into the user's browser.\n\nThe `annotation-xml` tag has slightly different behavior than the other \"integration point\"\ntags in MathML and SVG, but ammonia didn't handle it, so it didn't correctly\nstrip the namespace-incompatible tags.\n\nThis vulnerability only has an effect when the `math` and `annotation-xml` tags\nare both enabled, but the `encoding` attribute is disabled, because it relies\non the following sequence of steps:\n\n1. User writes code like `<math><annotation-xml encoding=\"text/html\"><gadget></annotation-xml></math>`.\n2. Namespace filtering checks the DOM, and it passes. `<gadget>` is parsed as HTML.\n3. Attribute filter strips it down to `<math><annotation-xml><gadget></annotation-xml></math>`. Because the encoding attribute is gone, `<gadget>` is now parsed as MathML.\n4. The gadget is written in such a way that it exploits the parsing differences between HTML and MathML.\n\nAdditionally, the gadget can only be written using a tag that is parsed as raw text in HTML.\nThese [elements] are:\n\n* title\n* textarea\n* xmp\n* iframe\n* noembed\n* noframes\n* plaintext\n* noscript\n* style\n* script\n\nApplications that do not explicitly allow any of these tags should not be affected, since none are allowed by default.\n\n[elements]: https://github.com/servo/html5ever/blob/045a0378f2b0f8d4a350793899cf722a2a9b3d11/html5ever/src/tree_builder/rules.rs\n\n### Impact\n\nLow: Requires both MathML and at least one raw-text HTML tag to be enabled, and most websites don't enable either of those.\n\n### Patches\n\n- https://github.com/rust-ammonia/ammonia/pull/245 (released in 4.1.3)\n- https://github.com/rust-ammonia/ammonia/pull/244 (released in 4.0.2)\n- https://github.com/rust-ammonia/ammonia/pull/243 (released in 3.3.2)\n\n### Workarounds\n\nCall <code>builder.[add_clean_content_tags](https://docs.rs/ammonia/latest/ammonia/struct.Builder.html#method.add_clean_content_tags)(\"annotation-xml\")</code> to remove the annotation-xml element and all of its children, including the XSS gadget.","format":"markdown","source":"ghsa"},{"lang":"en","text":"If a certain set of MathML tags are enabled, an attacker can inject arbitrary JavaScript code into the user's browser.\n\nThe `annotation-xml` tag has slightly different behavior than the other \"integration point\"\ntags in MathML and SVG, but ammonia didn't handle it, so it didn't correctly\nstrip the namespace-incompatible tags.\n\nThis vulnerability only has an effect when the `math` and `annotation-xml` tags\nare both enabled, but the `encoding` attribute is disabled, because it relies\non the following sequence of steps:\n\n1. User writes code like `<math><annotation-xml encoding=\"text/html\"><gadget></annotation-xml></math>`.\n2. Namespace filtering checks the DOM, and it passes. `<gadget>` is parsed as HTML.\n3. Attribute filter strips it down to `<math><annotation-xml><gadget></annotation-xml></math>`. Because the encoding attribute is gone, `<gadget>` is now parsed as MathML.\n4. The gadget is written in such a way that it exploits the parsing differences between HTML and MathML.\n\nAdditionally, the gadget can only be written using a tag that is parsed as raw text in HTML.\nThese [elements] are:\n\n* title\n* textarea\n* xmp\n* iframe\n* noembed\n* noframes\n* plaintext\n* noscript\n* style\n* script\n\nApplications that do not explicitly allow any of these tags should not be affected, since none are allowed by default.\n\n[elements]: https://github.com/servo/html5ever/blob/045a0378f2b0f8d4a350793899cf722a2a9b3d11/html5ever/src/tree_builder/rules.rs\n\n---\n\n**Discovered by:** [Ivan Ivančić](https://ivan09999.github.io/ammonia-mxss) · **Date:** 2026-06-29 · Found via local differential analysis and source review of ammonia's sanitisation pipeline; no third-party systems were tested.","format":"markdown","source":"rustsec"}],"published":"2026-06-30T12:00:00.000Z","modified":"2026-10-22T14:16:23.103Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","score":6.3,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","score":6.3,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N","rating":"MEDIUM"}],"cwes":["CWE-79"],"affected":[{"ranges":[{"version":"< 3.3.2","status":"affected"},{"version":">= 4.0.0, < 4.0.2","status":"affected"},{"version":">= 4.1.0, < 4.1.3","status":"affected"}],"vendor":"rust-ammonia","product":"ammonia","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"3.3.2"}],"ecosystem":"crates.io","package":"ammonia","purl":"pkg:cargo/ammonia","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"4.0.0","status":"affected","fixed":"4.0.2"}],"ecosystem":"crates.io","package":"ammonia","purl":"pkg:cargo/ammonia","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"4.1.0","status":"affected","fixed":"4.1.3"}],"ecosystem":"crates.io","package":"ammonia","purl":"pkg:cargo/ammonia","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0.0.0-0","status":"affected","fixed":"3.3.2"},{"type":"semver","introduced":"4.0.0","status":"affected","fixed":"4.0.2"},{"type":"semver","introduced":"4.1.0","status":"affected","fixed":"4.1.3"}],"ecosystem":"crates.io","package":"ammonia","purl":"pkg:cargo/ammonia","source":"rustsec"}],"references":[{"url":"https://github.com/rust-ammonia/ammonia/security/advisories/GHSA-9jh8-v38h-cvhr","tags":["exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/rust-ammonia/ammonia/pull/243","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/rust-ammonia/ammonia/pull/244","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/rust-ammonia/ammonia/pull/245","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/rust-ammonia/ammonia/commit/004bf2cee4288f74a6ee619d589e3e90c24c09ca","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/rust-ammonia/ammonia/commit/7ac3fd3145236f28857eeecbadb544c8659cba31","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/rust-ammonia/ammonia/commit/b51bf4f9749ed3cd518330105f20a2c39c9ee274","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/rust-ammonia/ammonia/releases/tag/v3.3.2","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/rust-ammonia/ammonia/releases/tag/v4.0.2","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/rust-ammonia/ammonia/releases/tag/v4.1.3","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://ivan09999.github.io/ammonia-mxss","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://rustsec.org/advisories/RUSTSEC-2026-0193.html","tags":["advisory","web","x-refsource-misc"],"sources":["cvelist","ghsa","rustsec","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-63430","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/rust-ammonia/ammonia","tags":["package"],"sources":["ghsa"]},{"url":"https://crates.io/crates/ammonia","tags":["package"],"sources":["rustsec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2026-10-15T20:24:18.831Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-63430","url":"https://www.cve.org/CVERecord?id=CVE-2026-63430","licence":"CVE Terms of Use","modified":"2026-10-15T20:25:49.464Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-9jh8-v38h-cvhr","url":"https://github.com/advisories/GHSA-9jh8-v38h-cvhr","licence":"CC-BY-4.0","modified":"2026-10-22T14:16:23.103Z"},{"source":"rustsec","name":"RustSec Advisory Database","id":"RUSTSEC-2026-0193","url":"https://rustsec.org/advisories/RUSTSEC-2026-0193.html","licence":"CC0-1.0","modified":"2026-07-17T05:41:42.316Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-63430","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-63430","licence":"Public domain","modified":"2026-10-16T16:00:33.533Z"}],"updatedAt":"2026-11-25T22:59:44.957Z","epss":{"score":0.00446,"percentile":0.40542,"date":"2026-12-01T12:00:22.000Z"}}