{"id":"GHSA-9jh8-v38h-cvhr","summary":"ammonia: mXSS  via MathML `annotation-xml` encoding strip","details":"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 `\u003cmath\u003e\u003cannotation-xml encoding=\"text/html\"\u003e\u003cgadget\u003e\u003c/annotation-xml\u003e\u003c/math\u003e`.\n2. Namespace filtering checks the DOM, and it passes. `\u003cgadget\u003e` is parsed as HTML.\n3. Attribute filter strips it down to `\u003cmath\u003e\u003cannotation-xml\u003e\u003cgadget\u003e\u003c/annotation-xml\u003e\u003c/math\u003e`. Because the encoding attribute is gone, `\u003cgadget\u003e` 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 \u003ccode\u003ebuilder.[add_clean_content_tags](https://docs.rs/ammonia/latest/ammonia/struct.Builder.html#method.add_clean_content_tags)(\"annotation-xml\")\u003c/code\u003e to remove the annotation-xml element and all of its children, including the XSS gadget.","aliases":["CVE-2026-63430","RUSTSEC-2026-0193"],"modified":"2026-10-22T14:16:23.103650626Z","published":"2026-10-22T14:06:10Z","database_specific":{"cwe_ids":["CWE-79"],"severity":"MODERATE","github_reviewed":true,"github_reviewed_at":"2026-10-22T14:06:10Z","nvd_published_at":"2026-10-15T19:17:42Z"},"references":[{"type":"WEB","url":"https://github.com/rust-ammonia/ammonia/security/advisories/GHSA-9jh8-v38h-cvhr"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-63430"},{"type":"WEB","url":"https://github.com/rust-ammonia/ammonia/pull/243"},{"type":"WEB","url":"https://github.com/rust-ammonia/ammonia/pull/244"},{"type":"WEB","url":"https://github.com/rust-ammonia/ammonia/pull/245"},{"type":"WEB","url":"https://github.com/rust-ammonia/ammonia/commit/004bf2cee4288f74a6ee619d589e3e90c24c09ca"},{"type":"WEB","url":"https://github.com/rust-ammonia/ammonia/commit/7ac3fd3145236f28857eeecbadb544c8659cba31"},{"type":"WEB","url":"https://github.com/rust-ammonia/ammonia/commit/b51bf4f9749ed3cd518330105f20a2c39c9ee274"},{"type":"PACKAGE","url":"https://github.com/rust-ammonia/ammonia"},{"type":"WEB","url":"https://github.com/rust-ammonia/ammonia/releases/tag/v3.3.2"},{"type":"WEB","url":"https://github.com/rust-ammonia/ammonia/releases/tag/v4.0.2"},{"type":"WEB","url":"https://github.com/rust-ammonia/ammonia/releases/tag/v4.1.3"},{"type":"WEB","url":"https://ivan09999.github.io/ammonia-mxss"},{"type":"WEB","url":"https://rustsec.org/advisories/RUSTSEC-2026-0193.html"}],"affected":[{"package":{"name":"ammonia","ecosystem":"crates.io","purl":"pkg:cargo/ammonia"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"3.3.2"}]}],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-9jh8-v38h-cvhr/GHSA-9jh8-v38h-cvhr.json"}},{"package":{"name":"ammonia","ecosystem":"crates.io","purl":"pkg:cargo/ammonia"},"ranges":[{"type":"SEMVER","events":[{"introduced":"4.0.0"},{"fixed":"4.0.2"}]}],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-9jh8-v38h-cvhr/GHSA-9jh8-v38h-cvhr.json"}},{"package":{"name":"ammonia","ecosystem":"crates.io","purl":"pkg:cargo/ammonia"},"ranges":[{"type":"SEMVER","events":[{"introduced":"4.1.0"},{"fixed":"4.1.3"}]}],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-9jh8-v38h-cvhr/GHSA-9jh8-v38h-cvhr.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V4","score":"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"}]}