CVE-2021-38193
Cross-site Scripting in ammonia
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.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- Required
What an attacker can affect
- Confidentiality
- Low
- Integrity
- Low
- Availability
- None
Exploit likelihood
What each source reports
NVD Score used
6.1
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.
- Record
CVE-2021-38193- CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N - CVSS 2.0
- 4.3 Medium
AV:N/AC:M/Au:N/C:N/I:P/A:N - Weakness
- CWE-79
- Updated
- 2026-11-02
CVE List No score
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.
- Record
CVE-2021-38193- Updated
- 2026-11-02
EUVDEUVD-2021-1568 No score
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.
- Record
EUVD-2021-1568- Updated
- 2026-11-03
GitHub AdvisoriesGHSA-5325-xw5m-phm3
6.1
Cross-site Scripting in ammonia
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.
- Record
GHSA-5325-xw5m-phm3- CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N - Weakness
- CWE-79
- Updated
- 2026-11-02
OSV
6.1
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.
- Record
CVE-2021-38193- CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N - Updated
- 2026-11-02
OSVDEBIAN-CVE-2021-38193
6.1
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.
- Record
DEBIAN-CVE-2021-38193- CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N - Updated
- 2026-11-02
OSVGHSA-5325-xw5m-phm3
6.1
Cross-site Scripting in ammonia
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.
- Record
GHSA-5325-xw5m-phm3- CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N - Weakness
- CWE-79
- Updated
- 2026-11-02
OSVUBUNTU-CVE-2021-38193
6.1
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.
- Record
UBUNTU-CVE-2021-38193- CVSS 3.1
- 6.1 Medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N - Updated
- 2026-11-02
OSVRUSTSEC-2021-0074 No score
Incorrect handling of embedded SVG and MathML leads to mutation XSS
Affected versions of this crate did not account for namespace-related parsing
differences between HTML, SVG, and MathML. Even if the svg and math elements
are not allowed, the underlying HTML parser still treats them differently.
Running cleanup without accounting for these differing namespaces resulted in an "impossible"
DOM, which appeared "safe" when examining the DOM tree, but when serialized and deserialized,
could be exploited to inject arbitrary markup.
To exploit this, the application using this library must allow a tag that is parsed as raw text in HTML. These elements are:
- title
- textarea
- xmp
- iframe
- noembed
- noframes
- plaintext
- noscript
- style
- script
Applications that do not explicitly allow any of these tags should not be affected, since none are allowed by default.
- Record
RUSTSEC-2021-0074- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
ammoniacrates.io |
3.0.0 up to 3.1.0 | 3.1.0 |
ammoniacrates.io |
before 2.1.3 | 2.1.3 |
rust-ammoniaDebian:12 |
before 3.1.2-1 | 3.1.2-1 |
rust-ammoniaDebian:13 |
before 3.1.2-1 | 3.1.2-1 |
rust-ammoniaDebian:14 |
before 3.1.2-1 | 3.1.2-1 |
ammoniacrates.io |
0.0.0-0 up to 2.1.3, 3.0.0 up to 3.1.0 | 2.1.33.1.0 |
rust-ammoniaUbuntu:22.04:LTS |
All versions, plus listed versions 3.1.0-23.1.2-1 |
None known |
rust-ammoniaUbuntu:24.04:LTS |
All versions, plus listed versions 3.2.1-13.3.0-1 |
None known |
rust-ammoniaUbuntu:25.10 |
All versions, plus listed versions 4.0.0-3 |
None known |
rust-ammoniaUbuntu:26.10 |
All versions, plus listed versions 4.1.2-14.1.4-1 |
None known |
rust-ammoniaUbuntu:26.04:LTS |
All versions, plus listed versions 4.0.0-34.1.2-1 |
None known |
History
| Recorded | Changed | Sources |
|---|---|---|
| aliases | EUVD | |
| first indexed | CVE List, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2021-38193 is a medium vulnerability (CVSS 6.1) in Ammonia Project Ammonia, published July 8, 2021. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.70%, the 53rd percentile. Fixed in ammonia 3.1.0.
References
rustsec.org/advisories/RUSTSEC-2021-0074.html
raw.githubusercontent.com/rustsec/advisory-db/main/crates/ammonia/RUSTSEC-2021-0074.md
nvd.nist.gov/vuln/detail/CVE-2021-38193
github.com/rust-ammonia/ammonia/pull/142
github.com/advisories/GHSA-5325-xw5m-phm3
security-tracker.debian.org/tracker/CVE-2021-38193