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.
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
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| AlmaLinux:8 | cargo | 1.66.1-2.module_el8.8.0+3604+b9bee1fc | ALSA-2023:4635 |
| AlmaLinux:9 | cargo | 1.66.1-2.el9_2 | ALSA-2023:4634 |
| AlmaLinux:8 | clippy | 1.66.1-2.module_el8.8.0+3604+b9bee1fc | ALSA-2023:4635 |
| AlmaLinux:9 | clippy | 1.66.1-2.el9_2 | ALSA-2023:4634 |
| AlmaLinux:8 | rust | 1.66.1-2.module_el8.8.0+3604+b9bee1fc | ALSA-2023:4635 |
| AlmaLinux:9 | rust | 1.66.1-2.el9_2 | ALSA-2023:4634 |
| AlmaLinux:8 | rust-analysis | 1.66.1-2.module_el8.8.0+3604+b9bee1fc | ALSA-2023:4635 |
| AlmaLinux:9 | rust-analysis | 1.66.1-2.el9_2 | ALSA-2023:4634 |
| AlmaLinux:8 | rust-analyzer | 1.66.1-2.module_el8.8.0+3604+b9bee1fc | ALSA-2023:4635 |
| AlmaLinux:9 | rust-analyzer | 1.66.1-2.el9_2 | ALSA-2023:4634 |
| AlmaLinux:8 | rust-debugger-common | 1.66.1-2.module_el8.8.0+3604+b9bee1fc | ALSA-2023:4635 |
| AlmaLinux:9 | rust-debugger-common | 1.66.1-2.el9_2 | ALSA-2023:4634 |
| AlmaLinux:8 | rust-doc | 1.66.1-2.module_el8.8.0+3604+b9bee1fc | ALSA-2023:4635 |
| AlmaLinux:9 | rust-doc | 1.66.1-2.el9_2 | ALSA-2023:4634 |
| AlmaLinux:8 | rust-gdb | 1.66.1-2.module_el8.8.0+3604+b9bee1fc | ALSA-2023:4635 |
| AlmaLinux:9 | rust-gdb | 1.66.1-2.el9_2 | ALSA-2023:4634 |
| AlmaLinux:8 | rust-lldb | 1.66.1-2.module_el8.8.0+3604+b9bee1fc | ALSA-2023:4635 |
| AlmaLinux:9 | rust-lldb | 1.66.1-2.el9_2 | ALSA-2023:4634 |
| AlmaLinux:8 | rust-src | 1.66.1-2.module_el8.8.0+3604+b9bee1fc | ALSA-2023:4635 |
| AlmaLinux:9 | rust-src | 1.66.1-2.el9_2 | ALSA-2023:4634 |
| AlmaLinux:8 | rust-std-static | 1.66.1-2.module_el8.8.0+3604+b9bee1fc | ALSA-2023:4635 |
| AlmaLinux:9 | rust-std-static | 1.66.1-2.el9_2 | ALSA-2023:4634 |
| AlmaLinux:8 | rust-std-static-wasm32-unknown-unknown | 1.66.1-2.module_el8.8.0+3604+b9bee1fc | ALSA-2023:4635 |
| AlmaLinux:9 | rust-std-static-wasm32-unknown-unknown | 1.66.1-2.el9_2 | ALSA-2023:4634 |
| AlmaLinux:8 | rust-std-static-wasm32-wasi | 1.66.1-2.module_el8.8.0+3604+b9bee1fc | ALSA-2023:4635 |
| AlmaLinux:9 | rust-std-static-wasm32-wasi | 1.66.1-2.el9_2 | ALSA-2023:4634 |
| AlmaLinux:8 | rust-toolset | 1.66.1-2.module_el8.8.0+3604+b9bee1fc | ALSA-2023:4635 |
| AlmaLinux:9 | rust-toolset | 1.66.1-2.el9_2 | ALSA-2023:4634 |
| AlmaLinux:8 | rustfmt | 1.66.1-2.module_el8.8.0+3604+b9bee1fc | ALSA-2023:4635 |
| AlmaLinux:9 | rustfmt | 1.66.1-2.el9_2 | ALSA-2023:4634 |
| Alpine:v3.24 | chromium-rust | 1.71.1-r0 | ALPINE-CVE-2023-38497 |
| Alpine:v3.20 | rust | 1.71.1-r0 | ALPINE-CVE-2023-38497 |
| Alpine:v3.21 | rust | 1.71.1-r0 | ALPINE-CVE-2023-38497 |
| Alpine:v3.22 | rust | 1.71.1-r0 | ALPINE-CVE-2023-38497 |
| Alpine:v3.23 | rust | 1.71.1-r0 | ALPINE-CVE-2023-38497 |
| Alpine:v3.24 | rust | 1.71.1-r0 | ALPINE-CVE-2023-38497 |
| Debian:12 | cargo | no fix listed | DEBIAN-CVE-2023-38497 |
| Debian:12 | rust-cargo | no fix listed | DEBIAN-CVE-2023-38497 |
| Debian:13 | rust-cargo | 0.76.0-1 | DEBIAN-CVE-2023-38497 |
| Debian:14 | rust-cargo | 0.76.0-1 | DEBIAN-CVE-2023-38497 |
| Rocky Linux:8 | rust | 0:1.66.1-2.module+el8.8.0+1428+0690fcea | RLSA-2023:4635 |
| Rocky Linux:9 | rust | 0:1.66.1-2.el9_2 | RLSA-2023:4634 |
| Ubuntu:24.04:LTS | rust-cargo | no fix listed | UBUNTU-CVE-2023-38497 |
| Ubuntu:24.04:LTS | rustc | 1.71.1+dfsg0ubuntu2-0ubuntu1 | UBUNTU-CVE-2023-38497 |
Affected products (as reported)
Weakness: CWE-278 · Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:N
References
- https://github.com/rust-lang/cargo/security/advisories/GHSA-j3xp-wfr4-hx87 x_refsource_CONFIRM
- https://github.com/rust-lang/cargo/pull/12443 x_refsource_MISC
- https://github.com/rust-lang/cargo/commit/d78bbf4bde3c6b95caca7512f537c6f9721426ff x_refsource_MISC
- https://en.wikipedia.org/wiki/Umask x_refsource_MISC
- https://github.com/rust-lang/wg-security-response/tree/main/patches/CVE-2023-38497 x_refsource_MISC
- https://www.rust-lang.org/policies/security x_refsource_MISC
- 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/