CVE-2026-5223: Rust Cargo symlink traversal in crate extraction

CVE-2026-5223 · Severity: medium · CVSS 4 · Published 2026-05-25

Cargo, the package manager for the Rust programming language, contains a vulnerability that affects users of third-party software registries. A malicious software package could be crafted to overwrite the source code of other packages stored in a developer's local cache. This could lead to the silent inclusion of malicious code in future software builds, potentially compromising the integrity of applications and development environments.

Technologies: cargo (crates.io). Vendors: crates.io.

Quick answers

Is CVE-2026-5223 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-5223 being exploited in the wild.
How severe is CVE-2026-5223?
Medium severity, with a CVSS score of 4, published 25 May 2026.
Which products and versions are affected?
cargo (crates.io) SEMVER:introduced=0,fixed=0.97.0; Rust Foundation Cargo < 0.97.0 (Rust < 1.96.0), All versions before Rust 1.96.0.
Is there a fix for CVE-2026-5223?
Yes. cargo (crates.io): upgrade to 0.97.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-5223 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2026-5223?
Check whether you run cargo (crates.io) or Rust Foundation Cargo at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • cargo (crates.io): upgrade to 0.97.0 or later
    cargo update -p cargo

Technical details

A vulnerability exists in Cargo's crate extraction logic where symbolic links (symlinks) within crate tarballs are not properly restricted. While Cargo has protections to prevent extraction outside the crate's cache directory, a crafted tarball can extract files one level below its own directory. This allows an attacker to overwrite the source code of other crates belonging to the same third-party registry within the local `~/.cargo` cache. The attack requires a user to download a malicious crate from a non-crates.io registry (as crates.io already blocks symlinks). The issue is resolved in Cargo version 0.97.0 (shipped with Rust 1.96.0) by rejecting all symlinks during extraction.

Affected products

  • Rust Cargo < 0.97.0 (Rust < 1.96.0)

Identifiers

  • CVE-2026-5223
  • GHSA-jq42-7mfv-hm57

Timeline

  • 2026-05-25: advisory: Initial advisory and NVD publication
  • 2026-05-28: patched: Rust 1.96.0 released with the fix
  • 2026-06-26: other: GitHub Advisory Database entry updated

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.