CVE-2021-38193
JSON

6.1medium

Cross-site Scripting in ammonia

Severity
6.1medium CVSS:3.1 by NVD
Exploit likelihood
0.70% (higher than 54% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
mitre
Also known as
GHSA-5325-xw5m-phm3RUSTSEC-2021-0074

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.

Affected

Product or packageVersionsReported by
Unspecified productn/aCVE List
ammonia (crates.io)from 3.0.0 before 3.1.0, before 2.1.3, from 0.0.0-0 before 2.1.3GitHub Advisory Database, RustSec Advisory Database
ammonia_project ammoniabefore 3.1.0NVD

All scores

GitHub6.1medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
NVD6.1medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
NVD4.3medium CVSS:2.0AV:N/AC:M/Au:N/C:N/I:P/A:N

Classification

What each source says

CVE List

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.

RustSec Advisory Database

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.

NVD (es)

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

References

Sources

SourceRecordLicence
CVE ListCVE-2021-38193 changed 2024-08-04CVE Terms of Use
GitHub Advisory DatabaseGHSA-5325-xw5m-phm3 changed 2023-11-08CC-BY-4.0
RustSec Advisory DatabaseRUSTSEC-2021-0074 changed 2023-11-08CC0-1.0
NVDCVE-2021-38193 changed 2026-06-17Public domain