Loading...
Skip to main content

CVE-2026-5223 — Cargo crates in cargo — CVE Details

MEDIUM

Cargo crates in third party registries can override the cached source of other crates

Published June 26, 2026Updated June 26, 2026Source: osv

Summary

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][1]. 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. [1]: https://rust-lang.org/policies/security

Advisory Timeline

  • First published June 26, 2026 (108 days ago).
  • Last revised June 26, 2026 — 0 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

Cargo
Update cargo to 0.97.0 or later
cargo update -p cargo --precise 0.97.0

After upgrading, run your dependency scanner again to confirm the vulnerability is resolved.

Affected Packages (1)

Affects 1 ecosystem: crates.io (1).

PackageEcosystemAffectedFixed In
cargo
crates.io
All versions0.97.0

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 9.6 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
P
Scope
—
Confidentiality
—
Integrity
—
Availability
—

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

Frequently Asked Questions

What is CVE-2026-5223?
Cargo crates in third party registries can override the cached source of other crates This vulnerability has been assigned a severity rating of MEDIUM (CVSS score: 9.6/10).
How do I check if my project is affected by CVE-2026-5223?
CVE-2026-5223 affects cargo. Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-5223 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
9.6

Exploitation is straightforward and causes maximum impact. Patch immediately.

Also Known As

GHSA-jq42-7mfv-hm57

Related CVEs

  • CVE-2019-16760
    HIGH

    Cargo prior to Rust 1.26.0 may download the wrong dependency

  • CVE-2023-38497
    HIGH

    Cargo not respecting umask when extracting crate archives

  • CVE-2026-102821
    MEDIUM

    Russh: Unbounded memory exhaustion via CHANNEL_OPEN flood during a client-stalled rekey

  • CVE-2026-102820
    MEDIUM

    pageant: Out-of-bounds read / oversized allocation in `pageant` MemoryMap::read via a malicious Pageant agent (Windows)

Check if you're affected

Scan your dependencies to see if this vulnerability affects your projects.

Scan Your Dependencies