// For flags

CVE-2023-38497

Cargo not respecting umask when extracting crate archives

Time Line
Published
2024-03-19
Updated
2024-03-19
Firt exploit
2024-03-19
Overview
Descriptions (4)
NVD, NVD, RedHat, PS
CWE (3)
CWE-276: Incorrect Default Permissions
CWE-278: Insecure Preserved Inherited Permissions
CWE-732: Incorrect Permission Assignment for Critical Resource
CAPEC (-)
Risk
CVSS Score
7.3 High
SSVC
Track*
KEV
-
EPSS
0.0%
Affected Products (-)
Vendors (2)
rust-lang, fedoraproject
Products (2)
cargo, fedora
Versions (2)
< 0.72.2, 38
Intel Resources (7)
Advisories (7)
PacketStorm
Exploits (-)
-
Plugins (-)
-
References (11)
General (5)
wikipedia, github, fedoraproject ...
Exploits & POcs (1)
github
Patches (2)
github
Advisories (3)
github, redhat
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.

*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
Attack Vector
Local
Attack Complexity
Low
Authentication
Single
Confidentiality
Complete
Integrity
Complete
Availability
Complete
* 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
  • 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)
Security Advisory details:

Select an advisory to view details here.

Select an exploit to view details here.

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