CVE-2026-5223: Cargo Remote Code Execution Vulnerability
MODERATECVE-2026-5223 is a MODERATE remote code execution vulnerability (CWE-61: UNIX Symbolic Link (Symlink) Following) affecting Cargo libraries in the crates.io ecosystem. The issue involves cargo crates in third party registries can override the cached source of other crates. Remediation is available by upgrading affected packages to version 0.97.0.
CVE-2026-5223 at a Glance
How to Fix CVE-2026-5223
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.97.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-2026-5223, 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.97.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-61: UNIX Symbolic Link (Symlink) Following, where the product, when opening a file or directory, does not sufficiently account for when the file is a symbolic link that resolves to a target outside of the intended control sphere. this could allow an attacker to cause the product to operate on unauthorized files. 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-2026-5223 Affected Cargo Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
cargo
|
crates.io |
< 0.97.0
|
0.97.0
|
References
Frequently Asked Questions
What is CVE-2026-5223?
Which Cargo versions are affected?
What version fixes CVE-2026-5223?
Is cargo affected?
What CWE is associated with CVE-2026-5223?
How can I check crates.io dependencies for CVE-2026-5223?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-jq42-7mfv-hm57",
"modified" : "2026-06-26T21:48:43Z",
"published" : "2026-06-26T21:48:43Z",
"aliases" : [ "CVE-2026-5223" ],
"summary" : "Cargo crates in third party registries can override the cached source of other crates",
"details" : "The Rust Security Response Team was notified that Cargo incorrectly handled symlinks inside of crate tarballs downloaded from third-party registries, allowing a malicious crate to override the source code of another crate from the same registry.\n\nThis vulnerability is tracked as CVE-2026-5223. The severity of the vulnerability is **medium** for users of third-party registries. Users of crates.io are **not affected**, as crates.io forbids uploading crates containing any symlink.\n\n## Overview\n\nWhen building a crate, Cargo extracts its source code in a local cache (stored within `~/.cargo`), reusing it for any future build. Cargo includes protections to prevent any file from being extracted outside of the crate's own cache directory.\n\nIt was discovered that it's possible to craft a malicious tarball able to extract files one level below the crate's own cache directory. With the way the cache is structured, that allowed the malicious crate to override the cache of other crates belonging to the same registry.\n\n## Mitigations\n\nRust 1.96.0, to be released on May 28th, 2026, will update Cargo to reject extracting *any* symlink within crate tarballs, regardless of whether they come from crates.io (which already forbids them) or third-party registries. Note that Cargo never added symlinks when running `cargo package` or `cargo publish`, so the impact of this should be minimal.\n\nUsers who are not able to upgrade to the most recent Rust version are recommended to audit the contents of their registry for the presence of any symlink, and to configure their registry to reject symlink (if such option is available).\n\n## Affected versions\n\nAll versions of Cargo shipped before Rust 1.96.0 are affected.\n\n## Acknowledgements\n\nCargo would like to thank Christos Papakonstantinou for reporting this to us according to the [Rust security policy][1].\n\nCargo also wants to thank the members of the Rust project who helped address the vulnerability: Josh Triplett for developing the fix; Arlo Siemsen for reviewing the fix; Emily Albini for writing this advisory; Emily Albini, Josh Stone and Manish Goregaokar for coordinating the disclosure; Ed Page and Eric Huss for advising during the disclosure.\n\n[1]: https://rust-lang.org/policies/security",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:L/VA:N/SC:H/SI:H/SA:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "crates.io",
"name" : "cargo"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.97.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/rust-lang/cargo/security/advisories/GHSA-jq42-7mfv-hm57"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-5223"
}, {
"type" : "WEB",
"url" : "https://github.com/rust-lang/cargo/pull/17031"
}, {
"type" : "WEB",
"url" : "https://blog.rust-lang.org/2026/05/25/cve-2026-5223"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/rust-lang/cargo"
}, {
"type" : "WEB",
"url" : "https://groups.google.com/g/rustlang-security-announcements/c/IB74S7Yksg8"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-61" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-06-26T21:48:43Z",
"nvd_published_at" : "2026-05-25T10:16:15Z"
}
}