{"id":"CVE-2021-38193","aliases":["CVE-2021-38193","GHSA-5325-xw5m-phm3","RUSTSEC-2021-0074"],"related":[],"kind":"vulnerability","state":"published","title":"Cross-site Scripting in ammonia","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"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","format":"markdown","source":"rustsec"},{"lang":"es","text":"Se ha detectado un problema en la crate ammonia versiones anteriores a 3.1.0 para Rust. Un ataque de tipo XSS puede ocurrir porque las diferencias de análisis para HTML, SVG y MathML son manejadas inapropiadamente, un problema similar a CVE-2020-26870","source":"nvd"}],"published":"2021-07-08T12:00:00.000Z","modified":"2026-06-17T04:01:43.997Z","severity":{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:N/AC:M/Au:N/C:N/I:P/A:N","score":4.3,"rating":"MEDIUM"}],"cwes":["CWE-79"],"affected":[{"ranges":[{"version":"n/a","status":"affected"}],"source":"cvelist"},{"ranges":[{"type":"semver","introduced":"3.0.0","status":"affected","fixed":"3.1.0"}],"ecosystem":"crates.io","package":"ammonia","purl":"pkg:cargo/ammonia","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"2.1.3"}],"ecosystem":"crates.io","package":"ammonia","purl":"pkg:cargo/ammonia","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0.0.0-0","status":"affected","fixed":"2.1.3"},{"type":"semver","introduced":"3.0.0","status":"affected","fixed":"3.1.0"}],"ecosystem":"crates.io","package":"ammonia","purl":"pkg:cargo/ammonia","source":"rustsec"},{"ranges":[{"status":"affected","fixed":"3.1.0"}],"vendor":"ammonia_project","product":"ammonia","cpe":"cpe:2.3:a:ammonia_project:ammonia:*:*:*:*:*:rust:*:*","source":"nvd"}],"references":[{"url":"https://rustsec.org/advisories/RUSTSEC-2021-0074.html","tags":["advisory","exploit","issue-tracking","patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","rustsec","nvd"]},{"url":"https://raw.githubusercontent.com/rustsec/advisory-db/main/crates/ammonia/RUSTSEC-2021-0074.md","tags":["third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-38193","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/rust-ammonia/ammonia/pull/142","tags":["web"],"sources":["ghsa","rustsec"]},{"url":"https://github.com/rust-ammonia/ammonia","tags":["package"],"sources":["ghsa"]},{"url":"https://crates.io/crates/ammonia","tags":["package"],"sources":["rustsec"]}],"credits":[],"assigner":"mitre","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2021-38193","url":"https://www.cve.org/CVERecord?id=CVE-2021-38193","licence":"CVE Terms of Use","modified":"2024-08-04T01:37:16.217Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-5325-xw5m-phm3","url":"https://github.com/advisories/GHSA-5325-xw5m-phm3","licence":"CC-BY-4.0","modified":"2023-11-08T04:06:26.105Z"},{"source":"rustsec","name":"RustSec Advisory Database","id":"RUSTSEC-2021-0074","url":"https://rustsec.org/advisories/RUSTSEC-2021-0074.html","licence":"CC0-1.0","modified":"2023-11-08T04:06:26.105Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-38193","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-38193","licence":"Public domain","modified":"2026-06-17T04:01:43.997Z"}],"updatedAt":"2026-11-25T22:58:03.055Z","epss":{"score":0.00705,"percentile":0.54579,"date":"2026-12-01T12:00:22.000Z"}}