{"id":"CVE-2021-38193","aliases":["DEBIAN-CVE-2021-38193","EUVD-2021-1568","GHSA-5325-xw5m-phm3","RUSTSEC-2021-0074","UBUNTU-CVE-2021-38193"],"status":"published","title":"Cross-site Scripting in ammonia","description":"An issue was discovered in the ammonia crate before 3.1.0 for Rust. XSS can occur because the parsing differences for HTML, SVG, and MathML are mishandled, a similar issue to CVE-2020-26870.","severity":{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium","assessor":"primary","from":"nvd"},"epss":{"day":"2026-11-12","score":0.00705,"percentile":0.53835,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-79"],"published":"2021-07-08T12:00:00Z","modified":"2026-10-24T10:31:04Z","fixes":[{"ecosystem":"crates.io","package":"ammonia","fixed_in":["3.1.0","2.1.3"],"sources":["ghsa","osv"]},{"ecosystem":"Debian:12","package":"rust-ammonia","fixed_in":["3.1.2-1"],"sources":["osv"]},{"ecosystem":"Debian:13","package":"rust-ammonia","fixed_in":["3.1.2-1"],"sources":["osv"]},{"ecosystem":"Debian:14","package":"rust-ammonia","fixed_in":["3.1.2-1"],"sources":["osv"]}],"affected":[{"source":"ghsa","ecosystem":"crates.io","package":"ammonia","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"3.0.0"},{"fixed":"3.1.0"}]}]},{"source":"ghsa","ecosystem":"crates.io","package":"ammonia","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"2.1.3"}]}]},{"source":"osv","ecosystem":"Debian:12","package":"rust-ammonia","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"3.1.2-1"}]}]},{"source":"osv","ecosystem":"Debian:13","package":"rust-ammonia","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"3.1.2-1"}]}]},{"source":"osv","ecosystem":"Debian:14","package":"rust-ammonia","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"3.1.2-1"}]}]},{"source":"osv","ecosystem":"crates.io","package":"ammonia","ranges":[{"type":"SEMVER","events":[{"introduced":"3.0.0"},{"fixed":"3.1.0"}]}]},{"source":"osv","ecosystem":"crates.io","package":"ammonia","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"2.1.3"}]}]},{"source":"osv","ecosystem":"crates.io","package":"ammonia","ranges":[{"type":"SEMVER","events":[{"introduced":"0.0.0-0"},{"fixed":"2.1.3"},{"introduced":"3.0.0"},{"fixed":"3.1.0"}]}]},{"source":"osv","ecosystem":"Ubuntu:22.04:LTS","package":"rust-ammonia","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["3.1.0-2","3.1.2-1"]},{"source":"osv","ecosystem":"Ubuntu:24.04:LTS","package":"rust-ammonia","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["3.2.1-1","3.3.0-1"]},{"source":"osv","ecosystem":"Ubuntu:25.10","package":"rust-ammonia","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["4.0.0-3"]},{"source":"osv","ecosystem":"Ubuntu:26.10","package":"rust-ammonia","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["4.1.2-1","4.1.4-1"]},{"source":"osv","ecosystem":"Ubuntu:26.04:LTS","package":"rust-ammonia","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["4.0.0-3","4.1.2-1"]}],"products":[{"vendor":"ammonia_project","product":"ammonia"}],"references":[{"url":"https://rustsec.org/advisories/RUSTSEC-2021-0074.html","tags":["x_refsource_MISC","x_transferred","Exploit","Issue Tracking","Patch","Third Party Advisory","fix","web","advisory","report"]},{"url":"https://raw.githubusercontent.com/rustsec/advisory-db/main/crates/ammonia/RUSTSEC-2021-0074.md","tags":["x_refsource_MISC","x_transferred","Third Party Advisory","advisory","web","report"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-38193","tags":["advisory"]},{"url":"https://github.com/rust-ammonia/ammonia/pull/142","tags":["web"]},{"url":"https://github.com/advisories/GHSA-5325-xw5m-phm3"},{"url":"https://security-tracker.debian.org/tracker/CVE-2021-38193","tags":["advisory"]},{"url":"https://github.com/rust-ammonia/ammonia","tags":["package"]},{"url":"https://crates.io/crates/ammonia","tags":["package"]},{"url":"https://ubuntu.com/security/CVE-2021-38193","tags":["report"]},{"url":"https://github.com/rust-ammonia/ammonia/commit/4b8426b89b861d9bea20e126576b0febb9d13515","tags":["report"]},{"url":"https://www.cve.org/CVERecord?id=CVE-2021-38193","tags":["report"]}],"sources":{"cve":[{"id":"CVE-2021-38193","description":"An issue was discovered in the ammonia crate before 3.1.0 for Rust. XSS can occur because the parsing differences for HTML, SVG, and MathML are mishandled, a similar issue to CVE-2020-26870.","status":"published","published":"2021-08-08T05:09:01Z","modified":"2024-08-04T01:37:16.217Z","updated_at":"2026-11-02T14:33:07.697752Z"}],"euvd":[{"id":"EUVD-2021-1568","description":"An issue was discovered in the ammonia crate before 3.1.0 for Rust. XSS can occur because the parsing differences for HTML, SVG, and MathML are mishandled, a similar issue to CVE-2020-26870.","status":"published","published":"2021-08-08T05:09:01Z","modified":"2024-08-04T01:37:16Z","updated_at":"2026-11-03T03:24:25.244479Z"}],"ghsa":[{"id":"GHSA-5325-xw5m-phm3","title":"Cross-site Scripting in ammonia","description":"An issue was discovered in the ammonia crate before 3.1.0 for Rust. XSS can occur because the parsing differences for HTML, SVG, and MathML are mishandled, a similar issue to CVE-2020-26870.","status":"published","published":"2021-08-25T20:55:56Z","modified":"2023-02-03T05:06:04Z","cvss":[{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T14:36:43.439065Z"}],"nvd":[{"id":"CVE-2021-38193","description":"An issue was discovered in the ammonia crate before 3.1.0 for Rust. XSS can occur because the parsing differences for HTML, SVG, and MathML are mishandled, a similar issue to CVE-2020-26870.","status":"published","published":"2021-08-08T06:15:09.043Z","modified":"2026-06-17T04:01:43.997Z","cvss":[{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium","assessor":"primary"},{"version":"2.0","score":4.3,"vector":"AV:N/AC:M/Au:N/C:N/I:P/A:N","level":"medium","assessor":"primary"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T14:06:56.562207Z"}],"osv":[{"id":"CVE-2021-38193","description":"An issue was discovered in the ammonia crate before 3.1.0 for Rust. XSS can occur because the parsing differences for HTML, SVG, and MathML are mishandled, a similar issue to CVE-2020-26870.","status":"published","published":"2021-08-08T06:15:09.043Z","modified":"2026-10-24T10:31:04.73781203Z","cvss":[{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium"}],"updated_at":"2026-11-02T15:44:20.843843Z"},{"id":"DEBIAN-CVE-2021-38193","description":"An issue was discovered in the ammonia crate before 3.1.0 for Rust. XSS can occur because the parsing differences for HTML, SVG, and MathML are mishandled, a similar issue to CVE-2020-26870.","status":"published","published":"2021-08-08T06:15:09.043Z","modified":"2026-10-23T18:03:31.792713411Z","cvss":[{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium"}],"updated_at":"2026-11-02T15:45:35.521549Z"},{"id":"GHSA-5325-xw5m-phm3","title":"Cross-site Scripting in ammonia","description":"An issue was discovered in the ammonia crate before 3.1.0 for Rust. XSS can occur because the parsing differences for HTML, SVG, and MathML are mishandled, a similar issue to CVE-2020-26870.","status":"published","published":"2021-08-25T20:55:56Z","modified":"2023-11-08T04:06:26.105627Z","cvss":[{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium"}],"cwes":["CWE-79"],"updated_at":"2026-11-02T15:46:37.864461Z"},{"id":"UBUNTU-CVE-2021-38193","description":"An issue was discovered in the ammonia crate before 3.1.0 for Rust. XSS can occur because the parsing differences for HTML, SVG, and MathML are mishandled, a similar issue to CVE-2020-26870.","status":"published","published":"2021-08-08T06:15:00Z","modified":"2026-10-17T12:55:47.50579863Z","cvss":[{"version":"3.1","score":6.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","level":"medium"}],"updated_at":"2026-11-02T15:54:28.526929Z"},{"id":"RUSTSEC-2021-0074","title":"Incorrect handling of embedded SVG and MathML leads to mutation XSS","description":"Affected versions of this crate did not account for namespace-related parsing\ndifferences between HTML, SVG, and MathML. Even if the `svg` and `math` elements\nare not allowed, the underlying HTML parser still treats them differently.\nRunning cleanup without accounting for these differing namespaces resulted in an \"impossible\"\nDOM, which appeared \"safe\" when examining the DOM tree, but when serialized and deserialized,\ncould be exploited to inject arbitrary markup.\n\nTo exploit this, the application using this library must allow 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/57eb334c0ffccc6f88d563419f0fbeef6ff5741c/html5ever/src/tree_builder/rules.rs","status":"published","published":"2021-07-08T12:00:00Z","modified":"2023-11-08T04:06:26.105627Z","updated_at":"2026-11-02T15:53:39.492624Z"}]}}
