UBUNTU-CVE-2022-36113 (CVE-2022-36113)

Vulnerability from osv_ubuntu – Published: 2022-09-14 18:15 – Updated: 2025-09-08 16:50 – Source website
VLAI
Details

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.

Upstream
Impacted products
Ecosystem Package Version
Ubuntu:Pro:16.04:LTS cargo
pkg:deb/ubuntu/cargo@0.47.0-1~exp1ubuntu1~16.04.1+esm1?arch=source&distro=esm-apps/xenial
Affected: All versions (ecosystem)
0.8.0-10.16.0-0ubuntu1~16.04.10.18.0-0ubuntu0.16.04.10.22.0-0ubuntu0.16.04.10.23.0-0ubuntu0.16.04.10.25.0-1ubuntu1~16.04.10.26.0-0ubuntu2~16.04.10.29.0-1ubuntu1~16.04.10.31.0-3ubuntu1~16.04.10.32.0-1~exp1ubuntu1~16.04.1 and 10 more (see JSON)
Ubuntu:Pro:18.04:LTS cargo
pkg:deb/ubuntu/cargo@0.66.0+ds0ubuntu0.libgit2-0ubuntu0.18.04.1~esm1?arch=source&distro=esm-apps/bionic
Affected: All versions (ecosystem)
0.19.0-0ubuntu10.22.0-0ubuntu10.22.0-0ubuntu20.23.0-0ubuntu10.24.0-1ubuntu10.25.0-1ubuntu10.26.0-0ubuntu10.26.0-0ubuntu20.29.0-1ubuntu1~18.04.10.31.0-3ubuntu1~18.04.4 and 17 more (see JSON)
Ubuntu:20.04:LTS cargo
pkg:deb/ubuntu/cargo@0.67.1+ds0ubuntu0.libgit2-0ubuntu0.20.04.2?arch=source&distro=focal
Affected: < 0.67.1+ds0ubuntu0.libgit2-0ubuntu0.20.04.2 (ecosystem)
0.37.0-3ubuntu20.38.0-0ubuntu10.39.0-0ubuntu10.39.0+really0.38.0-0ubuntu10.39.0+really0.39.0-0ubuntu10.40.0-3ubuntu10.40.0-3ubuntu20.41.0-0ubuntu10.42.0-0ubuntu10.44.1-0ubuntu1~20.04.1 and 7 more (see JSON)
Ubuntu:22.04:LTS cargo
pkg:deb/ubuntu/cargo@0.67.1+ds0ubuntu0.libgit2-0ubuntu0.22.04.2?arch=source&distro=jammy
Affected: < 0.67.1+ds0ubuntu0.libgit2-0ubuntu0.22.04.2 (ecosystem)
0.52.0-0ubuntu10.53.0-0ubuntu20.54.0-0ubuntu10.54.0-0ubuntu20.57.0+ubuntu-0ubuntu10.58.0-0ubuntu10.60.0ubuntu1-0ubuntu1~22.04.10.62.0ubuntu0libgit2-0ubuntu0.22.04.10.66.0+ds0ubuntu0.libgit2-0ubuntu0.22.04

{
  "affected": [
    {
      "ecosystem_specific": {
        "binaries": [
          {
            "binary_name": "cargo",
            "binary_version": "0.47.0-1~exp1ubuntu1~16.04.1+esm1"
          }
        ]
      },
      "package": {
        "ecosystem": "Ubuntu:Pro:16.04:LTS",
        "name": "cargo",
        "purl": "pkg:deb/ubuntu/cargo@0.47.0-1~exp1ubuntu1~16.04.1+esm1?arch=source\u0026distro=esm-apps/xenial"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ],
      "versions": [
        "0.8.0-1",
        "0.16.0-0ubuntu1~16.04.1",
        "0.18.0-0ubuntu0.16.04.1",
        "0.22.0-0ubuntu0.16.04.1",
        "0.23.0-0ubuntu0.16.04.1",
        "0.25.0-1ubuntu1~16.04.1",
        "0.26.0-0ubuntu2~16.04.1",
        "0.29.0-1ubuntu1~16.04.1",
        "0.31.0-3ubuntu1~16.04.1",
        "0.32.0-1~exp1ubuntu1~16.04.1",
        "0.33.0-1ubuntu1~16.04.1",
        "0.35.0-0ubuntu1~16.04.1",
        "0.36.0-0ubuntu1~16.04.1",
        "0.37.0-3ubuntu1~16.04.1",
        "0.38.0-0ubuntu1~16.04.1",
        "0.40.0-3ubuntu1~16.04.1",
        "0.42.0-0ubuntu1~16.04.1",
        "0.44.1-0ubuntu1~16.04.1",
        "0.47.0-1~exp1ubuntu1~16.04.1",
        "0.47.0-1~exp1ubuntu1~16.04.1+esm1"
      ]
    },
    {
      "ecosystem_specific": {
        "binaries": [
          {
            "binary_name": "cargo",
            "binary_version": "0.66.0+ds0ubuntu0.libgit2-0ubuntu0.18.04.1~esm1"
          }
        ]
      },
      "package": {
        "ecosystem": "Ubuntu:Pro:18.04:LTS",
        "name": "cargo",
        "purl": "pkg:deb/ubuntu/cargo@0.66.0+ds0ubuntu0.libgit2-0ubuntu0.18.04.1~esm1?arch=source\u0026distro=esm-apps/bionic"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ],
      "versions": [
        "0.19.0-0ubuntu1",
        "0.22.0-0ubuntu1",
        "0.22.0-0ubuntu2",
        "0.23.0-0ubuntu1",
        "0.24.0-1ubuntu1",
        "0.25.0-1ubuntu1",
        "0.26.0-0ubuntu1",
        "0.26.0-0ubuntu2",
        "0.29.0-1ubuntu1~18.04.1",
        "0.31.0-3ubuntu1~18.04.4",
        "0.32.0-1~exp1ubuntu1~18.04.1",
        "0.33.0-1ubuntu1~18.04.1",
        "0.35.0-0ubuntu1~18.04.1",
        "0.36.0-0ubuntu1~18.04.1",
        "0.37.0-3ubuntu1~18.04.1",
        "0.38.0-0ubuntu1~18.04.1",
        "0.40.0-3ubuntu1~18.04.1",
        "0.42.0-0ubuntu1~18.04.1",
        "0.44.1-0ubuntu1~18.04.1",
        "0.47.0-1~exp1ubuntu1~18.04.1",
        "0.52.0-0ubuntu1~18.04.1",
        "0.54.0-0ubuntu1~18.04.1",
        "0.58.0-0ubuntu1~18.04.1",
        "0.60.0ubuntu1-0ubuntu1~18.04.1",
        "0.62.0ubuntu0libgit2-0ubuntu0.18.04.1",
        "0.66.0+ds0ubuntu0.libgit2-0ubuntu0.18.04",
        "0.66.0+ds0ubuntu0.libgit2-0ubuntu0.18.04.1~esm1"
      ]
    },
    {
      "ecosystem_specific": {
        "availability": "No subscription required",
        "binaries": [
          {
            "binary_name": "cargo",
            "binary_version": "0.67.1+ds0ubuntu0.libgit2-0ubuntu0.20.04.2"
          }
        ]
      },
      "package": {
        "ecosystem": "Ubuntu:20.04:LTS",
        "name": "cargo",
        "purl": "pkg:deb/ubuntu/cargo@0.67.1+ds0ubuntu0.libgit2-0ubuntu0.20.04.2?arch=source\u0026distro=focal"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "0.67.1+ds0ubuntu0.libgit2-0ubuntu0.20.04.2"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ],
      "versions": [
        "0.37.0-3ubuntu2",
        "0.38.0-0ubuntu1",
        "0.39.0-0ubuntu1",
        "0.39.0+really0.38.0-0ubuntu1",
        "0.39.0+really0.39.0-0ubuntu1",
        "0.40.0-3ubuntu1",
        "0.40.0-3ubuntu2",
        "0.41.0-0ubuntu1",
        "0.42.0-0ubuntu1",
        "0.44.1-0ubuntu1~20.04.1",
        "0.47.0-1~exp1ubuntu1~20.04.1",
        "0.52.0-0ubuntu1~20.04.1",
        "0.54.0-0ubuntu1~20.04.1",
        "0.58.0-0ubuntu1~20.04.1",
        "0.60.0ubuntu1-0ubuntu1~20.04.1",
        "0.62.0ubuntu0libgit2-0ubuntu0.20.04.1",
        "0.66.0+ds0ubuntu0.libgit2-0ubuntu0.20.04"
      ]
    },
    {
      "ecosystem_specific": {
        "availability": "No subscription required",
        "binaries": [
          {
            "binary_name": "cargo",
            "binary_version": "0.67.1+ds0ubuntu0.libgit2-0ubuntu0.22.04.2"
          }
        ]
      },
      "package": {
        "ecosystem": "Ubuntu:22.04:LTS",
        "name": "cargo",
        "purl": "pkg:deb/ubuntu/cargo@0.67.1+ds0ubuntu0.libgit2-0ubuntu0.22.04.2?arch=source\u0026distro=jammy"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "0.67.1+ds0ubuntu0.libgit2-0ubuntu0.22.04.2"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ],
      "versions": [
        "0.52.0-0ubuntu1",
        "0.53.0-0ubuntu2",
        "0.54.0-0ubuntu1",
        "0.54.0-0ubuntu2",
        "0.57.0+ubuntu-0ubuntu1",
        "0.58.0-0ubuntu1",
        "0.60.0ubuntu1-0ubuntu1~22.04.1",
        "0.62.0ubuntu0libgit2-0ubuntu0.22.04.1",
        "0.66.0+ds0ubuntu0.libgit2-0ubuntu0.22.04"
      ]
    }
  ],
  "aliases": [],
  "details": "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\u0027s 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.",
  "id": "UBUNTU-CVE-2022-36113",
  "modified": "2025-09-08T16:50:19Z",
  "published": "2022-09-14T18:15:00Z",
  "references": [
    {
      "type": "REPORT",
      "url": "https://ubuntu.com/security/CVE-2022-36113"
    },
    {
      "type": "REPORT",
      "url": "https://github.com/rust-lang/cargo/commit/97b80919e404b0768ea31ae329c3b4da54bed05a"
    },
    {
      "type": "REPORT",
      "url": "https://github.com/rust-lang/cargo/security/advisories/GHSA-rfj2-q3h3-hm5j"
    },
    {
      "type": "REPORT",
      "url": "https://www.cve.org/CVERecord?id=CVE-2022-36113"
    }
  ],
  "related": [],
  "schema_version": "1.7.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:L/I:L/A:L",
      "type": "CVSS_V3"
    },
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H",
      "type": "CVSS_V3"
    },
    {
      "score": "low",
      "type": "Ubuntu"
    }
  ],
  "upstream": [
    "CVE-2022-36113"
  ]
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline

Sightings and recorded dates, grouped by day · UTC

JSON
How durations are calculated

Following the VTEM framework (Black Hat USA 2015), time to patch starts when the vendor or a coordinator was informed, total time to patch at discovery, and disclosure to patch at public disclosure; vendor response time runs from the report to its acknowledgement. Time to exploit and time unpatched start at the earliest discovery or report, falling back to public disclosure. Unpatched time ends at the first recorded patch, or the calculation time when no patch is recorded. Exploitation to patch shows the interval between those two events; a published proof of concept is a public exploit, not exploitation.

Each result shows its source dates. A negative interval means the end event came first; when date-only inputs leave the order open, the result says so. Date-only inputs are approximate. The earliest evidence wins: KEV report dates and sightings are labelled as such. Records describing another vulnerability are listed but never calculated from, and a PoC alone does not establish exploitation. Missing patch evidence does not prove that no patch exists. Filters below change the event list only.

Events included in the timeline

Loading timeline…


    Loading…

    Loading…

    Loading…

    Related by attack behaviour

    Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.