CVE-2021-38193: Cross-site Scripting in ammonia
6.1
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.4254%
CWE
Published
8/25/2021
Updated
2/3/2023
KEV Status
No
Technology
Rust
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
ammonia | rust | >= 3.0.0, < 3.1.0 | 3.1.0 |
ammonia | rust | < 2.1.3 | 2.1.3 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from improper namespace handling during DOM processing. The primary entry point ammonia::clean
and tag allowance mechanism Builder::add_tags
work in conjunction - the cleaner didn't properly validate namespace transitions when processing elements allowed via the builder. The GitHub fix introduced namespace validation checks during DOM construction, confirming these were missing in the vulnerable versions. The combination of allowing RCDATA elements and lacking namespace validation in DOM processing created the XSS vector.