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 package | Versions | Reported by |
|---|---|---|
| Unspecified product | n/a | CVE List |
| ammonia (crates.io) | from 3.0.0 before 3.1.0, before 2.1.3, from 0.0.0-0 before 2.1.3 | GitHub Advisory Database, RustSec Advisory Database |
| ammonia_project ammonia | before 3.1.0 | NVD |
All scores
| GitHub | 6.1medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N |
| NVD | 6.1medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N |
| NVD | 4.3medium CVSS:2.0 | AV: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
| https://rustsec.org/advisories/RUSTSEC-2021-0074.html | advisory, exploit, issue-tracking, patch, third-party-advisory, web | |
| https://raw.githubusercontent.com/rustsec/advisory-db/main/crates/ammonia/RUSTSEC-2021-0074.md | third-party-advisory, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2021-38193 | advisory | |
| https://github.com/rust-ammonia/ammonia/pull/142 | web | |
| https://github.com/rust-ammonia/ammonia | package | |
| https://crates.io/crates/ammonia | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2021-38193 changed 2024-08-04 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-5325-xw5m-phm3 changed 2023-11-08 | CC-BY-4.0 |
| RustSec Advisory Database | RUSTSEC-2021-0074 changed 2023-11-08 | CC0-1.0 |
| NVD | CVE-2021-38193 changed 2026-06-17 | Public domain |