Every CVE Search/ Get API key

CVE-2021-38193

Cross-site Scripting in ammonia

6.1 MediumFix available

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

0.70%Up 0.1 points since Aug 8, 2021
90%50%10%1%

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 MediumCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
CVSS 2.0
4.3 MediumAV: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 MediumCVSS: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 MediumCVSS: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 MediumCVSS: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 MediumCVSS: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 MediumCVSS: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

Affected packages
PackageAffectedFixed
ammonia
crates.io
3.0.0 up to 3.1.0
3.1.0
ammonia
crates.io
before 2.1.3
2.1.3
rust-ammonia
Debian:12
before 3.1.2-1
3.1.2-1
rust-ammonia
Debian:13
before 3.1.2-1
3.1.2-1
rust-ammonia
Debian:14
before 3.1.2-1
3.1.2-1
ammonia
crates.io
0.0.0-0 up to 2.1.3, 3.0.0 up to 3.1.0
2.1.33.1.0
rust-ammonia
Ubuntu:22.04:LTS
All versions, plus listed versions
3.1.0-23.1.2-1
None known
rust-ammonia
Ubuntu:24.04:LTS
All versions, plus listed versions
3.2.1-13.3.0-1
None known
rust-ammonia
Ubuntu:25.10
All versions, plus listed versions
4.0.0-3
None known
rust-ammonia
Ubuntu:26.10
All versions, plus listed versions
4.1.2-14.1.4-1
None known
rust-ammonia
Ubuntu:26.04:LTS
All versions, plus listed versions
4.0.0-34.1.2-1
None known

History

History
RecordedChangedSources
aliasesEUVD
first indexedCVE 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

Show 5 moreShow less
MoveEnter Open