CVE-2023-38497
Cargo not respecting umask when extracting crate archives
Summary
Descriptions
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`.
Cargo descarga las dependencias del proyecto Rust y compila el proyecto. Cargo antes de la versión 0.72.2, incluido con Rust antes de la versión 1.71.1, no respetaba la umask al extraer archivos crate en sistemas tipo UNIX. Si el usuario descargaba un crate que contenía archivos escribibles por cualquier usuario local, otro usuario local podía aprovecharse de esto para cambiar el código fuente compilado y ejecutado por el usuario actual. Para evitar que las extracciones en caché existentes puedan ser explotadas, el binario Cargo versión 0.72.2 incluido en Rust 1.71.1 o posterior purgará automáticamente las cachés generadas por versiones anteriores de Cargo. Como solución, configure su sistema para evitar que otros usuarios locales accedan al directorio Cargo, normalmente ubicado en `~/.cargo`.
A flaw was found in the rust-cargo package. Cargo, as bundled with the Rust compiler, did not respect the umask when extracting dependency tarballs and caching the extraction for future builds. If a dependency contained files with 0777 permissions, another local user could edit the cache of the extracted source code, potentially executing arbitrary code with the privileges of the user running Cargo during the next build.
Addison Crump discovered that Cargo incorrectly set file permissions on UNIX-like systems when extracting crate archives. If the crate would contain files writable by any user, a local attacker could possibly use this issue to execute code as another user.
CVSS Scores
SSVC
- Decision:Track*
Timeline
- 2023-07-18 CVE Reserved
- 2023-08-04 CVE Published
- 2023-08-05 EPSS Updated
- 2023-11-06 First Exploit
- 2025-02-13 CVE Updated
- ---------- Exploited in Wild
- ---------- KEV Due Date
CWE
- CWE-276: Incorrect Default Permissions
- CWE-278: Insecure Preserved Inherited Permissions
- CWE-732: Incorrect Permission Assignment for Critical Resource
CAPEC
Threat Intelligence Resources (7)
Select | Title | Date |
---|---|---|
Red Hat Security Advisory 2024-3418-03 | 2024-05-29 | |
Red Hat Security Advisory 2023-4634-01 | 2023-08-15 | |
Red Hat Security Advisory 2023-4651-01 | 2023-08-15 | |
Ubuntu Security Notice USN-6275-1 | 2023-08-04 | |
Red Hat Security Advisory 2024-3428-03 | 2024-05-29 | |
Red Hat Security Advisory 2023-4635-01 | 2023-08-15 | |
Gentoo Linux Security Advisory 202409-07 | 2024-09-23 |
Select an advisory to view details here.
Select | Title | Date |
---|
Select an exploit to view details here.
References (11)
URL | Date | SRC |
---|---|---|
https://github.com/lucas-cauhe/cargo-perm | 2023-11-06 |
URL | Date | SRC |
---|---|---|
https://github.com/rust-lang/cargo/commit/d78bbf4bde3c6b95caca7512f537c6f9721426ff | 2023-08-17 | |
https://github.com/rust-lang/cargo/pull/12443 | 2023-08-17 |
URL | Date | SRC |
---|---|---|
https://github.com/rust-lang/cargo/security/advisories/GHSA-j3xp-wfr4-hx87 | 2023-08-17 | |
https://access.redhat.com/security/cve/CVE-2023-38497 | 2024-05-28 | |
https://bugzilla.redhat.com/show_bug.cgi?id=2228038 | 2024-05-28 |
Affected Vendors, Products, and Versions
Vendor | Product | Version | Other | Status | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Vendor | Product | Version | Other | Status | <-- --> | Vendor | Product | Version | Other | Status |
Rust-lang Search vendor "Rust-lang" | Cargo Search vendor "Rust-lang" for product "Cargo" | < 0.72.2 Search vendor "Rust-lang" for product "Cargo" and version " < 0.72.2" | rust |
Affected
| ||||||
Fedoraproject Search vendor "Fedoraproject" | Fedora Search vendor "Fedoraproject" for product "Fedora" | 38 Search vendor "Fedoraproject" for product "Fedora" and version "38" | - |
Affected
|