{"id":"CVE-2023-38497","published":"2023-08-04T15:51:44Z","modified":"2025-02-13T17:01:51Z","title":"Cargo not respecting umask when extracting crate archives","vendor":"rust-lang","product":"cargo","tier":"tail","description":{"text":"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`.","provenance":"source","from":"CVE.org"},"cvss":{"score":7.8,"severity":"HIGH","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.0056,"percentile":0.40266,"provenance":"source"},"cwes":[{"id":"CWE-278","name":"Insecure Preserved Inherited Permissions"}],"references":[{"url":"https://github.com/rust-lang/cargo/security/advisories/GHSA-j3xp-wfr4-hx87","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/rust-lang/cargo/pull/12443","tags":["x_refsource_MISC"]},{"url":"https://github.com/rust-lang/cargo/commit/d78bbf4bde3c6b95caca7512f537c6f9721426ff","tags":["x_refsource_MISC"]},{"url":"https://en.wikipedia.org/wiki/Umask","tags":["x_refsource_MISC"]},{"url":"https://github.com/rust-lang/wg-security-response/tree/main/patches/CVE-2023-38497","tags":["x_refsource_MISC"]},{"url":"https://www.rust-lang.org/policies/security","tags":["x_refsource_MISC"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QGKE6PGM4HIQUHPJRBQAHMELINSGN4H4/","tags":[]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QMEXGUGPW5OBSQA6URTBNDSU3RAEFOZ4/","tags":[]}],"priority":{"score":18.5,"factors":[{"name":"EPSS percentile","points":8.05},{"name":"Public exploit code","points":5.0},{"name":"CVSS severity","points":5.46}]},"exploitSources":{"pocGithub":{"count":1,"skipped":0,"earliest":"2023-08-04","earliestUrl":"https://github.com/lucas-cauhe/cargo-perm","repos":[{"name":"lucas-cauhe/cargo-perm","url":"https://github.com/lucas-cauhe/cargo-perm","stars":1,"created":"2023-08-04"}]},"first":{"date":"2023-08-04","source":"PoC-in-GitHub","url":"https://github.com/lucas-cauhe/cargo-perm"},"provenance":"source"},"vendorSlug":"rust-lang","affectedVersions":[{"vendor":"rust-lang","product":"cargo","versions":["< 0.72.2"]}],"ssvc":{"exploitation":"none","automatable":"no","technicalImpact":"total","timestamp":"2024-10-08T18:02:25.711058Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"crates.io","package":"cargo","vulnerableRanges":["<0.72.2"],"patched":["0.72.2"],"from":["GHSA-j3xp-wfr4-hx87"],"provenance":"source"}],"summary":{"text":"Cargo, the Rust package manager and build tool, does not respect the umask when extracting crate archives on UNIX-like systems in versions before 0.72.2 (bundled with Rust before 1.71.1), so files extracted from a crate can be writeable by other local users. An attacker with a local account on the same machine can exploit this, provided the victim downloads a crate containing such writeable files and then builds or runs the project, to alter source code that the current user compiles and executes.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T21:14:00Z"},"euvd":{"id":"EUVD-2023-2308","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-rust-lang-cargo-cve-2022-36113","parents":[{"from":"CVE-2022-36113","to":"CVE-2023-38497","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["src/cargo/sources/registry/mod.rs"],"commits":["https://github.com/rust-lang/cargo/commit/97b80919e404b0768ea31ae329c3b4da54bed05a","https://github.com/rust-lang/cargo/commit/15f1e4b0bf4b4fc20369e0a85d9b77957c4dd52a","https://github.com/rust-lang/cargo/commit/d78bbf4bde3c6b95caca7512f537c6f9721426ff"],"basis":"rarely changed file"}]},{"from":"CVE-2022-36114","to":"CVE-2023-38497","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["src/cargo/sources/registry/mod.rs","src/cargo/util/mod.rs"],"commits":["https://github.com/rust-lang/cargo/commit/d1f9553c825f6d7481453be8d58d0e7f117988a7","https://github.com/rust-lang/cargo/commit/2b68d3c07a4a056264dc006ecb9f1354a0679cd3","https://github.com/rust-lang/cargo/commit/d78bbf4bde3c6b95caca7512f537c6f9721426ff"],"basis":"rarely changed file"}]}]}}