CVE-2019-16760: Cargo Cargo Prior To Rust 1.26.0 Vulnerability
HIGHCVE-2019-16760 is a HIGH (CVSS 7.5) cargo prior to rust 1.26.0 vulnerability (CWE-494: Download of Code Without Integrity Check) affecting Cargo libraries in the crates.io ecosystem. The issue involves cargo prior to rust 1.26.0 may download the wrong dependency. Remediation is available by upgrading affected packages to version 0.27.0.
CVE-2019-16760 at a Glance
Security Impact
CVSS: 7.5
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:N/S:U/C:N/I:H/A:N).
How to Fix CVE-2019-16760
To remediate this vulnerability, upgrade all affected Cargo 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 cargo to 0.27.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for cargo
How to Check if You Are Affected
To determine whether your application is affected by CVE-2019-16760, inspect your project dependencies for Cargo:
inspect dependencies for cargo
Analyze the terminal output to locate any version of Cargo in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.27.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-494: Download of Code Without Integrity Check, where the product downloads source code or an executable from a remote location and executes the code without sufficiently verifying the origin and integrity of the code. In Cargo, 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-2019-16760 Affected Cargo Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
cargo
|
crates.io |
< 0.27.0
|
0.27.0
|
References
Frequently Asked Questions
What is CVE-2019-16760?
Which Cargo versions are affected?
What version fixes CVE-2019-16760?
Is cargo affected?
What is the CVSS score of CVE-2019-16760?
What CWE is associated with CVE-2019-16760?
How can I check crates.io dependencies for CVE-2019-16760?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-9f3p-wvj7-q82x",
"modified" : "2024-08-29T18:03:14Z",
"published" : "2022-05-24T16:57:30Z",
"aliases" : [ "CVE-2019-16760" ],
"summary" : "Cargo prior to Rust 1.26.0 may download the wrong dependency",
"details" : "Cargo prior to Rust 1.26.0 may download the wrong dependency if your package.toml file uses the `package` configuration key. Usage of the `package` key to rename dependencies in `Cargo.toml` is ignored in Rust 1.25.0 and prior. When Rust 1.25.0 and prior is used Cargo may download the wrong dependency, which could be squatted on crates.io to be a malicious package. This not only affects manifests that you write locally yourself, but also manifests published to crates.io. Rust 1.0.0 through Rust 1.25.0 is affected by this advisory because Cargo will ignore the `package` key in manifests. Rust 1.26.0 through Rust 1.30.0 are not affected and typically will emit an error because the `package` key is unstable. Rust 1.31.0 and after are not affected because Cargo understands the `package` key. Users of the affected versions are strongly encouraged to update their compiler to the latest available one. Preventing this issue from happening requires updating your compiler to be either Rust 1.26.0 or newer. There will be no point release for Rust versions prior to 1.26.0. Users of Rust 1.19.0 to Rust 1.25.0 can instead apply linked patches to mitigate the issue.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "crates.io",
"name" : "cargo"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.27.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/rust-lang/rust/security/advisories/GHSA-phjm-8x66-qw4r"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2019-16760"
}, {
"type" : "WEB",
"url" : "https://gist.github.com/pietroalbini/0d293b24a44babbeb6187e06eebd4992"
}, {
"type" : "WEB",
"url" : "https://groups.google.com/forum/#!topic/rustlang-security-announcements/rVQ5e3TDnpQ"
}, {
"type" : "WEB",
"url" : "https://groups.google.com/forum/#%21topic/rustlang-security-announcements/rVQ5e3TDnpQ"
}, {
"type" : "WEB",
"url" : "http://www.openwall.com/lists/oss-security/2019/10/08/3"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-494" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2024-08-29T18:03:14Z",
"nvd_published_at" : "2019-09-30T22:15:00Z"
}
}