CVE-2026-5223: Crates in third party registries can override the cached source of other crates

Published May 25, 2026
·
Updated

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. 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.

Other sources

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

Microsoft

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

GitHub

Affected Software

5 affected componentsFixes available
Rust Cargo
rust-lang Cargo Rust<1.96.0
Microsoft azl3 rust 1.75.0-29<1.75.0-30
1.75.0-30
Microsoft azl3 rust 1.90.0-8<1.90.0-9
1.90.0-9
rust/cargo<0.97.0
0.97.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 1.75.0-30
  2. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 1.90.0-9
  3. Upgrade

    Upgrade rust/cargo to a version that resolves this vulnerability.

    Fixed in 0.97.0
  4. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 1.96.0
  5. Configuration

    For users who cannot upgrade to Rust 1.96.0, configure the third-party crate registry to reject symlink (if such an option is available) and audit registry contents for any symlink.

    Cargo registry configuration (third-party registries) reject symlink in crate tarballs = true
  6. Operational

    Audit the contents of your registry for the presence of any symlink if you cannot upgrade to Rust 1.96.0.

Event History

May 25, 2026
CVE Published
via MITRE·08:57 AM
Data Sourced
via MITRE·08:57 AM
RemedyDescriptionWeakness
Data Sourced
via NVD·10:16 AM
RemedyDescriptionSeverityWeaknessAffected Software
May 27, 2026
Data Sourced
via Microsoft·08:18 AM
DescriptionSeverityWeakness
Data Sourced
via Microsoft·08:18 AM
Affected Software
Updated
via Microsoft·08:18 AM
Affected Software
Updated
via Microsoft·08:18 AM
DescriptionSeverity
Jun 26, 2026
Advisory Published
via GitHub·09:48 PM
Data Sourced
via GitHub·09:48 PM
DescriptionWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-5223?

The severity of CVE-2026-5223 is medium for users of third-party registries.

2

How do I fix CVE-2026-5223?

To fix CVE-2026-5223, update to Rust 1.96.0 or later, which will reject any symlink in crate tarballs.

3

What is the impact of CVE-2026-5223?

CVE-2026-5223 allows a malicious crate to override the source code of another crate from the same third-party registry.

4

Which software is affected by CVE-2026-5223?

CVE-2026-5223 affects Rust Cargo, particularly when using third-party registries.

5

When was CVE-2026-5223 published?

CVE-2026-5223 was published on May 25, 2026.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203