CVE catalog

CVE-2022-36113

cargo: CVE-2022-36113

[CVE catalog]

Severity
Medium · CVSS 5.4CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:N/I:H/A:L
Published
Source
[NVD] · [CVE record]
EPSS
1.21% · Oct 25, 2026

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.

Vulnerable and fixed packages

Distribution-reported package versions and fixes. These do not depend on matching against the OpenFactory package catalog.

DistributionPackageReleaseVersionStatus
Debiancargobookworm0.66.0+ds1-1fixed
Debianrust-cargosid0.99.0-1fixed
Debianrust-cargoforky0.99.0-1fixed
Debianrust-cargotrixie0.86.0-2fixed
Debianrust-cargobookworm0.66.0-1fixed
Opensuserust1.62tumbleweed1.62.1-3.1fixed
Ubuntucargopro0.19.0-0ubuntu1vulnerable
Ubuntucargopro0.22.0-0ubuntu1vulnerable
Ubuntucargopro0.22.0-0ubuntu2vulnerable
Ubuntucargopro0.23.0-0ubuntu1vulnerable
Ubuntucargopro0.24.0-1ubuntu1vulnerable
Ubuntucargopro0.25.0-1ubuntu1vulnerable
Ubuntucargopro0.26.0-0ubuntu1vulnerable
Ubuntucargopro0.26.0-0ubuntu2vulnerable
Ubuntucargopro0.29.0-1ubuntu1~18.04.1vulnerable
Ubuntucargopro0.31.0-3ubuntu1~18.04.4vulnerable
Ubuntucargopro0.32.0-1~exp1ubuntu1~18.04.1vulnerable
Ubuntucargopro0.33.0-1ubuntu1~18.04.1vulnerable
Ubuntucargopro0.35.0-0ubuntu1~18.04.1vulnerable
Ubuntucargopro0.36.0-0ubuntu1~18.04.1vulnerable
Ubuntucargopro0.37.0-3ubuntu1~18.04.1vulnerable
Ubuntucargopro0.38.0-0ubuntu1~18.04.1vulnerable
Ubuntucargopro0.40.0-3ubuntu1~18.04.1vulnerable
Ubuntucargopro0.42.0-0ubuntu1~18.04.1vulnerable
Ubuntucargopro0.44.1-0ubuntu1~18.04.1vulnerable
Ubuntucargopro0.47.0-1~exp1ubuntu1~18.04.1vulnerable
Ubuntucargopro0.52.0-0ubuntu1~18.04.1vulnerable
Ubuntucargopro0.54.0-0ubuntu1~18.04.1vulnerable
Ubuntucargopro0.58.0-0ubuntu1~18.04.1vulnerable
Ubuntucargopro0.60.0ubuntu1-0ubuntu1~18.04.1vulnerable
Ubuntucargopro0.62.0ubuntu0libgit2-0ubuntu0.18.04.1vulnerable
Ubuntucargopro0.66.0+ds0ubuntu0.libgit2-0ubuntu0.18.04vulnerable
Ubuntucargopro0.66.0+ds0ubuntu0.libgit2-0ubuntu0.18.04.1~esm1vulnerable
Ubuntucargo20.040.37.0-3ubuntu2vulnerable
Ubuntucargo20.040.38.0-0ubuntu1vulnerable
Ubuntucargo20.040.39.0-0ubuntu1vulnerable
Ubuntucargo20.040.39.0+really0.38.0-0ubuntu1vulnerable
Ubuntucargo20.040.39.0+really0.39.0-0ubuntu1vulnerable
Ubuntucargo20.040.40.0-3ubuntu1vulnerable
Ubuntucargo20.040.40.0-3ubuntu2vulnerable
Ubuntucargo20.040.41.0-0ubuntu1vulnerable
Ubuntucargo20.040.42.0-0ubuntu1vulnerable
Ubuntucargo20.040.44.1-0ubuntu1~20.04.1vulnerable
Ubuntucargo20.040.47.0-1~exp1ubuntu1~20.04.1vulnerable
Ubuntucargo20.040.52.0-0ubuntu1~20.04.1vulnerable
Ubuntucargo20.040.54.0-0ubuntu1~20.04.1vulnerable
Ubuntucargo20.040.58.0-0ubuntu1~20.04.1vulnerable
Ubuntucargo20.040.60.0ubuntu1-0ubuntu1~20.04.1vulnerable
Ubuntucargo20.040.62.0ubuntu0libgit2-0ubuntu0.20.04.1vulnerable
Ubuntucargo20.040.66.0+ds0ubuntu0.libgit2-0ubuntu0.20.04vulnerable
Ubuntucargo20.040.67.1+ds0ubuntu0.libgit2-0ubuntu0.20.04.2fixed
Ubuntucargo22.040.52.0-0ubuntu1vulnerable
Ubuntucargo22.040.53.0-0ubuntu2vulnerable
Ubuntucargo22.040.54.0-0ubuntu1vulnerable
Ubuntucargo22.040.54.0-0ubuntu2vulnerable
Ubuntucargo22.040.57.0+ubuntu-0ubuntu1vulnerable
Ubuntucargo22.040.58.0-0ubuntu1vulnerable
Ubuntucargo22.040.60.0ubuntu1-0ubuntu1~22.04.1vulnerable
Ubuntucargo22.040.62.0ubuntu0libgit2-0ubuntu0.22.04.1vulnerable
Ubuntucargo22.040.66.0+ds0ubuntu0.libgit2-0ubuntu0.22.04vulnerable
Ubuntucargo22.040.67.1+ds0ubuntu0.libgit2-0ubuntu0.22.04.2fixed
Opensuserust1.63tumbleweed1.63.0-3.1fixed
Suserust1.62linux enterprise module for development tools 15 sp31.62.1-150300.7.7.1fixed
Suserust1.62linux enterprise module for development tools 15 sp41.62.1-150300.7.7.1fixed
Opensuserust1.62leap 15.31.62.1-150300.7.7.1fixed
Opensuserust1.62leap 15.41.62.1-150300.7.7.1fixed

Fixed-version evidence

DistributionPackageTypeReleaseFixed versionUrgencyOriginBugs
Debiancargosourcebookworm0.63.1-1not yet assignedNot reported[1021142]
Debianrust-cargosourcesid0.66.0-1not yet assignedNot reported[1021143]
Debianrust-cargosourceforky0.66.0-1not yet assignedNot reported[1021143]
Debianrust-cargosourcetrixie0.66.0-1not yet assignedNot reported[1021143]
Debianrust-cargosourcebookworm0.66.0-1not yet assignedNot reported[1021143]
Opensuserust1.62rpmtumbleweed1.62.1-3.1Not reportedOPENSUSE-SU-2024:12343-1Not reported
Ubuntucargodeb20.040.67.1+ds0ubuntu0.libgit2-0ubuntu0.20.04.2Not reportedUBUNTU-CVE-2022-36113Not reported
Ubuntucargodeb22.040.67.1+ds0ubuntu0.libgit2-0ubuntu0.22.04.2Not reportedUBUNTU-CVE-2022-36113Not reported
Opensuserust1.63rpmtumbleweed1.63.0-3.1Not reportedOPENSUSE-SU-2024:12344-1Not reported
Suserust1.62rpmlinux enterprise module for development tools 15 sp31.62.1-150300.7.7.1Not reportedSUSE-SU-2022:3451-1Not reported
Suserust1.62rpmlinux enterprise module for development tools 15 sp41.62.1-150300.7.7.1Not reportedSUSE-SU-2022:3451-1Not reported
Opensuserust1.62rpmleap 15.31.62.1-150300.7.7.1Not reportedSUSE-SU-2022:3451-1Not reported
Opensuserust1.62rpmleap 15.41.62.1-150300.7.7.1Not reportedSUSE-SU-2022:3451-1Not reported

[Debian bug #1021142][Debian bug #1021143]

OpenFactory catalog packages

[Debian 12 (Bookworm)]

  • [cargo]Fixed
    Details (2)
    • 0.66.0+ds1-1 · amd64 · bookworm

      Fixed · Fixed: 0.63.1-1

      dsa · cargo · debian · bookworm

    • 0.66.0+ds1-1 · arm64 · bookworm

      Fixed · Fixed: 0.63.1-1

      dsa · cargo · debian · bookworm

  • [cargo-doc]Fixed

    Source package: [cargo]

    Details (2)
    • 0.66.0+ds1-1 · all · bookworm

      Fixed · Fixed: 0.63.1-1

      dsa · cargo · debian · bookworm

    • 0.66.0+ds1-1 · all · bookworm

      Fixed · Fixed: 0.63.1-1

      dsa · cargo · debian · bookworm

  • Source package: [rust-cargo]

    Details (2)
    • 0.66.0-1 · amd64 · bookworm

      Fixed · Fixed: 0.66.0-1

      dsa · rust-cargo · debian · bookworm

    • 0.66.0-1 · arm64 · bookworm

      Fixed · Fixed: 0.66.0-1

      dsa · rust-cargo · debian · bookworm

Observed:

References