Vulnerability · Published Aug 4, 2023 · Assigned by GitHub_M

CVE-2023-38497Cargo not respecting umask when extracting crate archives

High 7.8

In plain English

A high-severity security flaw in cargo from rust-lang. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.7% (higher than 53% of all known vulnerabilities). Ready-made attack tooling exists: public proof-of-concept code. Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)7.8High
Exploit odds (30 days)0.7%top 46.6% of all CVEs
Exploited in the wildNo reportsCISA SSVC: none
Attack tooling1Public PoC

Official description

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`.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
AlmaLinux:8cargo1.66.1-2.module_el8.8.0+3604+b9bee1fcALSA-2023:4635
AlmaLinux:9cargo1.66.1-2.el9_2ALSA-2023:4634
AlmaLinux:8clippy1.66.1-2.module_el8.8.0+3604+b9bee1fcALSA-2023:4635
AlmaLinux:9clippy1.66.1-2.el9_2ALSA-2023:4634
AlmaLinux:8rust1.66.1-2.module_el8.8.0+3604+b9bee1fcALSA-2023:4635
AlmaLinux:9rust1.66.1-2.el9_2ALSA-2023:4634
AlmaLinux:8rust-analysis1.66.1-2.module_el8.8.0+3604+b9bee1fcALSA-2023:4635
AlmaLinux:9rust-analysis1.66.1-2.el9_2ALSA-2023:4634
AlmaLinux:8rust-analyzer1.66.1-2.module_el8.8.0+3604+b9bee1fcALSA-2023:4635
AlmaLinux:9rust-analyzer1.66.1-2.el9_2ALSA-2023:4634
AlmaLinux:8rust-debugger-common1.66.1-2.module_el8.8.0+3604+b9bee1fcALSA-2023:4635
AlmaLinux:9rust-debugger-common1.66.1-2.el9_2ALSA-2023:4634
AlmaLinux:8rust-doc1.66.1-2.module_el8.8.0+3604+b9bee1fcALSA-2023:4635
AlmaLinux:9rust-doc1.66.1-2.el9_2ALSA-2023:4634
AlmaLinux:8rust-gdb1.66.1-2.module_el8.8.0+3604+b9bee1fcALSA-2023:4635
AlmaLinux:9rust-gdb1.66.1-2.el9_2ALSA-2023:4634
AlmaLinux:8rust-lldb1.66.1-2.module_el8.8.0+3604+b9bee1fcALSA-2023:4635
AlmaLinux:9rust-lldb1.66.1-2.el9_2ALSA-2023:4634
AlmaLinux:8rust-src1.66.1-2.module_el8.8.0+3604+b9bee1fcALSA-2023:4635
AlmaLinux:9rust-src1.66.1-2.el9_2ALSA-2023:4634
AlmaLinux:8rust-std-static1.66.1-2.module_el8.8.0+3604+b9bee1fcALSA-2023:4635
AlmaLinux:9rust-std-static1.66.1-2.el9_2ALSA-2023:4634
AlmaLinux:8rust-std-static-wasm32-unknown-unknown1.66.1-2.module_el8.8.0+3604+b9bee1fcALSA-2023:4635
AlmaLinux:9rust-std-static-wasm32-unknown-unknown1.66.1-2.el9_2ALSA-2023:4634
AlmaLinux:8rust-std-static-wasm32-wasi1.66.1-2.module_el8.8.0+3604+b9bee1fcALSA-2023:4635
AlmaLinux:9rust-std-static-wasm32-wasi1.66.1-2.el9_2ALSA-2023:4634
AlmaLinux:8rust-toolset1.66.1-2.module_el8.8.0+3604+b9bee1fcALSA-2023:4635
AlmaLinux:9rust-toolset1.66.1-2.el9_2ALSA-2023:4634
AlmaLinux:8rustfmt1.66.1-2.module_el8.8.0+3604+b9bee1fcALSA-2023:4635
AlmaLinux:9rustfmt1.66.1-2.el9_2ALSA-2023:4634
Alpine:v3.24chromium-rust1.71.1-r0ALPINE-CVE-2023-38497
Alpine:v3.20rust1.71.1-r0ALPINE-CVE-2023-38497
Alpine:v3.21rust1.71.1-r0ALPINE-CVE-2023-38497
Alpine:v3.22rust1.71.1-r0ALPINE-CVE-2023-38497
Alpine:v3.23rust1.71.1-r0ALPINE-CVE-2023-38497
Alpine:v3.24rust1.71.1-r0ALPINE-CVE-2023-38497
Debian:12cargono fix listedDEBIAN-CVE-2023-38497
Debian:12rust-cargono fix listedDEBIAN-CVE-2023-38497
Debian:13rust-cargo0.76.0-1DEBIAN-CVE-2023-38497
Debian:14rust-cargo0.76.0-1DEBIAN-CVE-2023-38497
Rocky Linux:8rust0:1.66.1-2.module+el8.8.0+1428+0690fceaRLSA-2023:4635
Rocky Linux:9rust0:1.66.1-2.el9_2RLSA-2023:4634
Ubuntu:24.04:LTSrust-cargono fix listedUBUNTU-CVE-2023-38497
Ubuntu:24.04:LTSrustc1.71.1+dfsg0ubuntu2-0ubuntu1UBUNTU-CVE-2023-38497

Affected products (as reported)

VendorProductVersions
rust-lang cargo < 0.72.2

Weakness: CWE-278 · Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N

References