CVE-2026-5223 — cargo
Fix: rust-lang/cargo#17031CVE-2026-5223 is a CWE-61 vulnerability in cargo. A fix is available for cargo — see the affected versions and patch details below.
Cargo crates in third party registries can override the cached source of other crates
Exploitation Status
No confirmed exploitation observed yet
- CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.
Exploitation and automatability from CISA’s SSVC triage for CVE-2026-5223.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
Real-World Exposure
cargoReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects crates.io packages — download data is not available via public APIs for these ecosystems.
Description
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.
This 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.
Overview
When 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.
It 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.
Mitigations
Rust 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.
Users 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).
Affected versions
All versions of Cargo shipped before Rust 1.96.0 are affected.
Acknowledgements
Cargo would like to thank Christos Papakonstantinou for reporting this to us according to the Rust security policy.
Cargo 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.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🦀crates.io | cargo | all versions | 0.97.0cargo update -p cargo --precise 0.97.0 |
Affected Products
cargorust-langDetection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for cargo, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update cargo to 0.97.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2026-5223 is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
This Moderate vulnerability in Cargo arises from improper handling of symlinks within crate tarballs downloaded from third-party registries. An attacker could exploit this by publishing a malicious crate containing symlinks, leading to the overwrite of source code from other crates in the same registry. Red Hat…
To mitigate this issue, avoid using untrusted third-party Cargo registries. If third-party registries are necessary, ensure they enforce strict policies against symlinks in crate tarballs and verify the integrity of downloaded crates. No direct configuration or operational workaround is available within Cargo itself to prevent this specific symlink mishandling when using vulnerable third-party registries.Source: Red Hat security advisory for CVE-2026-5223 (CC BY 4.0)
| Product | Fixed in | Advisory |
|---|---|---|
| Red Hat Hardened Images | rust-main-1.97.1-1.1.hum1 | RHSA-2026:42923 |
Frequently Asked Questions
Is CVE-2026-5223 in your dependencies?
Find it across crates.io, including transitive dependencies.