Skip to content
Heist/ feed
Back to feed
High

Cargo not respecting umask when extracting crate archives

Type: advisorySources: OSV

Cargo downloads the Rust project’s dependencies and compiles the project. Cargo prior to version 0.72.2, bundled with Rust prior to version 1.71.1, did not respect the umask when extracting crate archives on UNIX-like systems. If the user downloaded a crate containing files writeable by any local user, another local user could exploit this to change the source code compiled and executed by the current user. To prevent existing cached extractions from being exploitable, the Cargo binary version 0.72.2 included in Rust 1.71.1 or later will purge caches generated by older Cargo versions automatically. As a workaround, configure one's system to prevent other local users from accessing the Cargo directory, usually located in `~/.cargo`.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2023-38497
Confirmed fixed CVEs
Not specified
Updated in this feed
5 Nov 2026, 03:25 UTC · Revision 1

Source evidence

Cargo not respecting umask when extracting crate archives

core-osv · Original source

Published 4 Aug 2023, 15:51 UTC

Cargo downloads the Rust project’s dependencies and compiles the project. Cargo prior to version 0.72.2, bundled with Rust prior to version 1.71.1, did not respect the umask when extracting crate archives on UNIX-like systems. If the user downloaded a crate containing files writeable by any local user, another local user could exploit this to change the source code compiled and executed by the current user. To prevent existing cached extractions from being exploitable, the Cargo binary version 0.72.2 included in Rust 1.71.1 or later will purge caches generated by older Cargo versions automatically. As a workaround, configure one's system to prevent other local users from accessing the Cargo directory, usually located in `~/.cargo`.

osv:CVE-2023-38497
Complete source record
{
  "id": "c1634568ee2d563337a95d718950282bddf844e668394bb60eb6bee73b09b26f",
  "url": "https://osv.dev/vulnerability/CVE-2023-38497",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Cargo not respecting umask when extracting crate archives",
    "summary": "Cargo downloads the Rust project’s dependencies and compiles the project. Cargo prior to version 0.72.2, bundled with Rust prior to version 1.71.1, did not respect the umask when extracting crate archives on UNIX-like systems. If the user downloaded a crate containing files writeable by any local user, another local user could exploit this to change the source code compiled and executed by the current user. To prevent existing cached extractions from being exploitable, the Cargo binary version 0.72.2 included in Rust 1.71.1 or later will purge caches generated by older Cargo versions automatically. As a workaround, configure one's system to prevent other local users from accessing the Cargo directory, usually located in `~/.cargo`.",
    "evidence": "osv:CVE-2023-38497",
    "products": [],
    "severity": "high",
    "structured": {
      "id": "CVE-2023-38497",
      "aliases": [
        "CVE-2023-38497",
        "GHSA-j3xp-wfr4-hx87"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/rust-lang/cargo",
              "type": "GIT",
              "events": [
                {
                  "introduced": "0"
                },
                {
                  "fixed": "1a737af0c83b28c1f249b821a76a19c82696b05a"
                },
                {
                  "fixed": "d78bbf4bde3c6b95caca7512f537c6f9721426ff"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "cpe": "cpe:2.3:a:rust-lang:cargo:*:*:*:*:*:rust:*:*",
                    "range": [
                      {
                        "introduced": "0"
                      },
                      {
                        "fixed": "0.72.2"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "range": [
                      {
                        "fixed": "d78bbf4bde3c6b95caca7512f537c6f9721426ff"
                      }
                    ],
                    "source": "REFERENCES_COMMIT"
                  }
                ]
              }
            }
          ],
          "versions": [
            "0.72.1",
            "0.72.0",
            "home-0.5.5",
            "0.59.0",
            "0.54.0",
            "0.43.0",
            "0.42.0",
            "0.37.0",
            "0.36.0",
            "0.30.0",
            "0.14.0",
            "0.13.0",
            "0.12.0",
            "0.11.0",
            "0.10.0",
            "0.9.0",
            "0.8.0",
            "0.7.0",
            "0.6.0",
            "0.5.0",
            "0.4.0",
            "0.3.0",
            "0.2.0",
            "0.1.0",
            "v0.0.1-pre"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2023-38497.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:42.363850729Z",
      "provider": "osv",
      "references": [
        "https://en.wikipedia.org/wiki/Umask",
        "https://github.com/rust-lang/wg-security-response/tree/main/patches/CVE-2023-38497",
        "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QGKE6PGM4HIQUHPJRBQAHMELINSGN4H4/",
        "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QMEXGUGPW5OBSQA6URTBNDSU3RAEFOZ4/",
        "https://www.rust-lang.org/policies/security",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/38xxx/CVE-2023-38497.json",
        "https://github.com/rust-lang/cargo/security/advisories/GHSA-j3xp-wfr4-hx87",
        "https://nvd.nist.gov/vuln/detail/CVE-2023-38497",
        "https://github.com/rust-lang/cargo/commit/d78bbf4bde3c6b95caca7512f537c6f9721426ff",
        "https://github.com/rust-lang/cargo/pull/12443"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-278"
        ],
        "cna_assigner": "GitHub_M",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/38xxx/CVE-2023-38497.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2023-38497",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 509835,
  "published_at": "2023-08-04T15:51:44.878+00:00"
}