cve.bz

CVE-2022-36113 rust-lang cargo: Link Following

8.1 highEPSS 1.3%Fix available

High (8.1) in rust-lang cargo. EPSS 1.3% estimated probability of exploitation activity in the next 30 days. Fixed in cargo 0.65.0, 0.67.0.

On this page
Cargo is a package manager for the rust programming language. After a package is downloaded, Cargo extracts its source code in the ~/.cargo folder on disk, making it available to the Rust projects it builds. To record when an extraction is successful, Cargo writes "ok" to the .cargo-ok file at the root of the extracted source code once it extracted all the files. It was discovered that Cargo allowed packages to contain a .cargo-ok symbolic link, which Cargo would extract. Then, when Cargo attempted to write "ok" into .cargo-ok, it would actually replace the first two bytes of the file the symlink pointed to with ok. This would allow an attacker to corrupt one file on the machine using Cargo to extract the package. Note that by design Cargo allows code execution at build time, due to build scripts and procedural macros. The vulnerabilities in this advisory allow performing a subset of the possible damage in a harder to track down way. Your dependencies must still be trusted if you want to be protected from attacks, as it's possible to perform the same attacks with build scripts and procedural macros. The vulnerability is present in all versions of Cargo. Rust 1.64, to be released on September 22nd, will include a fix for it. Since the vulnerability is just a more limited way to accomplish what a malicious build scripts or procedural macros can do, we decided not to publish Rust point releases backporting the security fix. Patch files are available for Rust 1.63.0 are available in the wg-security-response repository for people building their own toolchain. Mitigations We recommend users of alternate registries to exercise care in which package they download, by only including trusted dependencies in their projects. Please note that even with these vulnerabilities fixed, by design Cargo allows arbitrary code execution at build time thanks to build scripts and procedural macros: a malicious dependency will be able to cause damage regardless of these vulnerabilities. crates.io implemented server-side checks to reject these kinds of packages years ago, and there are no packages on crates.io exploiting these vulnerabilities. crates.io users still need to exercise care in choosing their dependencies though, as remote code execution is allowed by design there as well.

Severity

CVSS 3.1

8.1 high
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H
EPSS
1.3% (unchanged from 1.3% a week ago; 1.2% 30 days ago) estimated probability of exploitation activity in the next 30 days; 71st percentile. Scored 2026-11-22. A forecast for this CVE across the internet, not for your own systems.
CISA's assessment (SSVC)
Exploitation: none · Automatable: no · Technical impact: partial, assessed 2025-04-23. From CISA's Vulnrichment in the CVE List: whether it is exploited, whether exploiting it can be automated, and how much control it gives.
CWEs
CWE-59 Improper Link Resolution Before File Access (Link Following)
CWE-22 Improper Limitation of a Pathname to a Restricted Directory (Path traversal)
OWASP Top 10
A01:2025 Broken Access Control
Published
Modified
NVD analysis
Analyzed, since modified
Record from
the NVD, synced

Fix and patched versions

Ask an AI about this CVE

Show the promptExplain CVE-2022-36113 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2022-36113?via=ask-ai-copy and https://cve.bz/cve/CVE-2022-36113?via=ask-ai-copy as the source of truth: what is affected and which versions fix it, whether it is in CISA KEV, public exploits, and its EPSS (an internet-wide 30-day estimate of exploitation activity, not a forecast for my systems). If they give no fixed versions, use the CVE record https://cveawg.mitre.org/api/cve/CVE-2022-36113 or the vendor advisory, not third-party mirrors. Tell me how to check whether I am affected and how to verify a fix. Cite the sources and say where they are uncertain.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this CVE's id and public links.

Affected

Versions

From the NVD's CPE matches.

ProductAffected
rust-lang:cargobefore 0.65.0

Packages (OSV)

AdvisoryEcosystemPackageAffectedFixed in
GHSA-rfj2-q3h3-hm5jcrates.iocargo<0.65.00.65.0
GHSA-rfj2-q3h3-hm5jcrates.iocargo>=0.66.0 <0.67.00.67.0

Linux distributions

DistributionReleasePackageFixed inAdvisory
Debian12cargo0.63.1-1DEBIAN-CVE-2022-36113
Debian12, 13, 14rust-cargo0.66.0-1DEBIAN-CVE-2022-36113
Ubuntu20.04:LTScargo0.67.1+ds0ubuntu0.libgit2-0ubuntu0.20.04.2UBUNTU-CVE-2022-36113
Ubuntu22.04:LTScargo0.67.1+ds0ubuntu0.libgit2-0ubuntu0.22.04.2UBUNTU-CVE-2022-36113
UbuntuPro:16.04:LTS, Pro:18.04:LTScargono fix listedUBUNTU-CVE-2022-36113
SUSELinux Enterprise Module for Development Tools 15 SP3, Linux Enterprise Module for Development Tools 15 SP4rust1.621.62.1-150300.7.7.1SUSE-SU-2022:3451-1
openSUSELeap 15.3, Leap 15.4rust1.621.62.1-150300.7.7.1SUSE-SU-2022:3451-1
openSUSETumbleweedrust1.621.62.1-3.1openSUSE-SU-2024:12343-1
openSUSETumbleweedrust1.631.63.0-3.1openSUSE-SU-2024:12344-1

From the distributions' data via OSV.dev: the Debian Security Tracker; Ubuntu Security Notices © Canonical Ltd., CC BY-SA 4.0; SUSE security data, CC BY 4.0. Modified: reformatted and linked to CVE records. Credits. On the distributions' own pages: Debian · Ubuntu · SUSE · openSUSE.

Attack patterns (CAPEC)

  • CAPEC-17 Using Malicious Files Likelihood: High · Severity: Very High
  • CAPEC-35 Leverage Executable Code in Non-Executable Files Likelihood: High · Severity: Very High
  • CAPEC-76 Manipulating Web Input to File System Calls Likelihood: High · Severity: Very High
  • CAPEC-132 Symlink Attack Likelihood: Low · Severity: High
  • CAPEC-64 Using Slashes and URL Encoding Combined to Bypass Validation Logic Likelihood: High · Severity: High
  • CAPEC-78 Using Escaped Slashes in Alternate Encoding Likelihood: High · Severity: High
  • CAPEC-79 Using Slashes in Alternate Encoding Likelihood: High · Severity: High
  • CAPEC-126 Path Traversal Likelihood: High · Severity: Very High

The attack patterns MITRE's CAPEC relates to this record's weaknesses, as MITRE names them. Credits.

References

Check your stackJSON