// For flags

CVE-2023-38497

Cargo not respecting umask when extracting crate archives

Severity Score

7.3
*CVSS v3.1

Exploit Likelihood

*EPSS

Affected Versions

*CPE

Public Exploits

0
*Multiple Sources

Exploited in Wild

-
*KEV

Decision

Track*
*SSVC
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.

*Credits: N/A
CVSS Scores
Attack Vector
Local
Attack Complexity
Low
Privileges Required
Low
User Interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High
Attack Vector
Local
Attack Complexity
Low
Privileges Required
Low
User Interaction
Required
Scope
Changed
Confidentiality
High
Integrity
High
Availability
None
Attack Vector
Local
Attack Complexity
High
Privileges Required
Low
User Interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High
* Common Vulnerability Scoring System
SSVC
  • Decision:Track*
Exploitation
None
Automatable
No
Tech. Impact
Total
* Organization's Worst-case Scenario
Timeline
  • 2023-07-18 CVE Reserved
  • 2023-08-04 CVE Published
  • 2023-08-05 EPSS Updated
  • 2024-10-08 CVE Updated
  • ---------- Exploited in Wild
  • ---------- KEV Due Date
  • ---------- First Exploit
CWE
  • CWE-276: Incorrect Default Permissions
  • CWE-278: Insecure Preserved Inherited Permissions
  • CWE-732: Incorrect Permission Assignment for Critical Resource
CAPEC
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