CVE-2021-38193: Ammonia Cross-Site Scripting Vulnerability
MODERATECVE-2021-38193 is a MODERATE (CVSS 6.1) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Ammonia libraries in the crates.io ecosystem. The issue involves cross-site scripting in ammonia. Remediation is available by upgrading affected packages to version 3.1.0, 2.1.3.
CVE-2021-38193 at a Glance
Security Impact
CVSS: 6.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N).
How to Fix CVE-2021-38193
To remediate this vulnerability, upgrade all affected Ammonia dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade ammonia to 3.1.0
Upgrade ammonia to 2.1.3
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for ammonia
How to Check if You Are Affected
To determine whether your application is affected by CVE-2021-38193, inspect your project dependencies for Ammonia:
inspect dependencies for ammonia
Analyze the terminal output to locate any version of Ammonia in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.1.0), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Ammonia, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2021-38193 Affected Ammonia Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
ammonia
|
crates.io |
≥ 3.0.0
< 3.1.0
|
3.1.0
|
|
ammonia
|
crates.io |
< 2.1.3
|
2.1.3
|
References
Frequently Asked Questions
What is CVE-2021-38193?
Which Ammonia versions are affected?
What version fixes CVE-2021-38193?
Is ammonia affected?
What is the CVSS score of CVE-2021-38193?
What CWE is associated with CVE-2021-38193?
How can I check crates.io dependencies for CVE-2021-38193?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-5325-xw5m-phm3",
"modified" : "2021-08-18T21:28:38Z",
"published" : "2021-08-25T20:55:56Z",
"aliases" : [ "CVE-2021-38193" ],
"summary" : "Cross-site Scripting in ammonia",
"details" : "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.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "crates.io",
"name" : "ammonia"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.0.0"
}, {
"fixed" : "3.1.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "crates.io",
"name" : "ammonia"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.1.3"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-38193"
}, {
"type" : "WEB",
"url" : "https://github.com/rust-ammonia/ammonia/pull/142"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/rust-ammonia/ammonia"
}, {
"type" : "WEB",
"url" : "https://raw.githubusercontent.com/rustsec/advisory-db/main/crates/ammonia/RUSTSEC-2021-0074.md"
}, {
"type" : "WEB",
"url" : "https://rustsec.org/advisories/RUSTSEC-2021-0074.html"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2021-08-18T21:28:38Z",
"nvd_published_at" : "2021-08-08T06:15:00Z"
}
}