Insecure Crate Extraction in Cargo (CVE-2023-38497)

rust Updated 02 Oct 2025

Summary

04/08/2023
N/A
Yes i
High
7.3

CVE-2023-38497: Cargo downloads the Rust project’s dependencies and compiles the project. Affects rust across 2 version ranges.

< 1.71.1-r0 < d78bbf4bde3c6b95caca7512f537c6f9721426ff

Fixed in 1.71.1-r0. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Cargo is a package manager for the Rust programming language. It is responsible for downloading dependencies and compiling Rust projects. Rust is a systems programming language known for its memory safety and concurrency features. However, Cargo, bundled with Rust, had a vulnerability that allowed local users to exploit the extraction of crate archives on UNIX-like systems. This vulnerability, tracked as CVE-2023-38497, could potentially lead to unauthorized changes in the source code executed by the current user.

Vulnerability Detail

The vulnerability in Cargo (prior to version 0.72.2) arises from the improper handling of file permissions during the extraction of crate archives. Cargo did not respect the umask on UNIX-like systems, which meant that if a user downloaded a crate containing files writable by any local user, another local user could exploit this to modify the source code compiled and executed by the current user. This could lead to unauthorized code execution, privilege escalation, or other malicious activities. The vulnerability was fixed in Cargo version 0.72.2, included in Rust version 1.71.1 or later.

How To Fix

Minimum fixed version

1.71.1-r0

This is the first release that contains the fix.

sudo apk add --upgrade rust

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a workaround, users can configure their systems to restrict access to the Cargo directory, typically located in ~/.cargo. By preventing other local users from accessing this directory, the risk of exploitation can be mitigated. However, this workaround may not be feasible in all scenarios, and it is recommended to apply the official fix by updating Cargo and Rust.

Conclusion

The vulnerability in Cargo (CVE-2023-38497) allowed local users to modify the source code executed by the current user. This could lead to unauthorized code execution and other malicious activities. To mitigate this vulnerability, it is crucial to update Cargo to version 0.72.2 or later, bundled with Rust version 1.71.1 or later. Regularly updating Rust and its associated tools is also recommended. For further assistance and support in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for rust →

Share this vulnerability

FAQ

Cargo is a package manager for the Rust programming language. It handles dependency management and project compilation.

Rust is a systems programming language known for its memory safety and concurrency features. It provides a safer alternative to languages like C and C++.

The vulnerability in Cargo could allow local users to modify the source code executed by the current user. This could lead to unauthorized code execution, privilege escalation, or other malicious activities.

To fix this vulnerability, update Cargo to version 0.72.2 or later, bundled with Rust version 1.71.1 or later. Regularly updating Rust and its associated tools is also recommended.

A workaround is to restrict access to the Cargo directory (~/.cargo) to prevent other local users from exploiting the vulnerability. However, it is recommended to apply the official fix by updating Cargo and Rust.

Related vulnerabilities

Recent vulnerabilities recorded for rust.

How To Fix

Minimum fixed version

1.71.1-r0

This is the first release that contains the fix.

sudo apk add --upgrade rust

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback