The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2023-38497

CVE-2023-38497: Rust-lang Cargo Privilege Escalation Flaw

CVE-2023-38497 is a privilege escalation vulnerability in Rust-lang Cargo that allows local users to modify source code during crate extraction. This article covers technical details, affected versions, and mitigation.

Published: February 4, 2026

CVE-2023-38497 Overview

CVE-2023-38497 is an Insecure Permissions vulnerability in Rust's Cargo package manager that affects how crate archives are extracted on UNIX-like systems. Cargo prior to version 0.72.2, bundled with Rust prior to version 1.71.1, did not respect the system umask when extracting crate archives. This oversight allows malicious crate authors to include files with world-writable permissions, which local attackers can then exploit to modify source code before compilation.

Critical Impact

Local attackers can exploit this vulnerability to modify source code in cached crate extractions, potentially injecting malicious code that gets compiled and executed by other users on the same system.

Affected Products

  • Rust-lang Cargo versions prior to 0.72.2
  • Rust versions prior to 1.71.1
  • Fedora 38 (affected via bundled Cargo packages)

Discovery Timeline

  • August 4, 2023 - CVE-2023-38497 published to NVD
  • November 21, 2024 - Last updated in NVD database

Technical Details for CVE-2023-38497

Vulnerability Analysis

The vulnerability stems from Cargo's failure to apply the user's umask when extracting files from crate archives. On UNIX-like systems, the umask is a bitmask that determines the default permission bits that should be cleared when creating new files. By ignoring the umask, Cargo preserves whatever permissions are set in the source archive, including potentially dangerous world-writable permissions (0o777 or 0o666).

This creates a local privilege escalation scenario where a malicious crate author could craft a crate containing source files with overly permissive permissions. When a developer downloads and extracts such a crate, another local user on the same multi-user system could modify the extracted source code before it gets compiled. The modified code would then execute with the privileges of the original user who ran the build.

The vulnerability is tracked under CWE-278 (Insecure Preserved Inherited Permissions) and CWE-732 (Incorrect Permission Assignment for Critical Resource).

Root Cause

The root cause lies in Cargo's archive extraction logic in src/cargo/sources/registry/mod.rs. The extraction process did not query or apply the current user's umask value when writing files to the local cache directory (~/.cargo). This meant that file permissions embedded in crate archives were used directly, bypassing the system's intended permission restrictions.

Attack Vector

This is a local attack vector requiring the attacker to have local user access on the same system as the victim. The attack flow involves:

  1. An attacker publishes a malicious crate to crates.io (or a private registry) containing files with world-writable permissions
  2. A victim developer adds the crate as a dependency and runs cargo build or cargo fetch
  3. Cargo extracts the crate to ~/.cargo/registry/src/ preserving the world-writable permissions
  4. The local attacker modifies the extracted source files
  5. When the victim runs subsequent builds, the modified malicious code gets compiled and executed

The patch introduces a get_umask() function that properly retrieves and applies the system umask:

rust
/// Get the current [`umask`] value.
///
/// [`umask`]: https://man7.org/linux/man-pages/man2/umask.2.html
#[cfg(unix)]
pub fn get_umask() -> u32 {
    use std::sync::OnceLock;
    static UMASK: OnceLock<libc::mode_t> = OnceLock::new();
    // SAFETY: Syscalls are unsafe. Calling `umask` twice is even unsafer for
    // multithreading program, since it doesn't provide a way to retrive the
    // value without modifications. We use a static `OnceLock` here to ensure
    // it only gets call once during the entire program lifetime.
    *UMASK.get_or_init(|| unsafe {
        let umask = libc::umask(0o022);
        libc::umask(umask);
        umask
    }) as u32 // it is u16 on macos
}

Source: GitHub Cargo Commit Change

Detection Methods for CVE-2023-38497

Indicators of Compromise

  • Files in ~/.cargo/registry/src/ with world-writable permissions (-rw-rw-rw- or -rwxrwxrwx)
  • Unexpected modifications to source files in cached crate directories
  • Discrepancies between crate source hashes and registry-published hashes
  • File ownership changes in the Cargo cache directory

Detection Strategies

  • Run find ~/.cargo -type f -perm -0002 to identify world-writable files in the Cargo cache
  • Compare modification timestamps of cached crate files against their original download times
  • Monitor file system events on the ~/.cargo/registry/src/ directory for unexpected write operations
  • Audit Cargo version (cargo --version) across development environments to identify vulnerable installations

Monitoring Recommendations

  • Implement file integrity monitoring (FIM) on developer workstations targeting the ~/.cargo directory
  • Set up alerts for permission changes in Cargo cache directories on shared development servers
  • Regularly audit installed Cargo/Rust versions in CI/CD pipelines and development environments
  • Monitor for unusual build behavior or unexpected binary changes in compiled artifacts

How to Mitigate CVE-2023-38497

Immediate Actions Required

  • Upgrade Rust to version 1.71.1 or later, which includes Cargo 0.72.2 with the security fix
  • Run cargo build or cargo fetch after upgrading to trigger automatic purging of vulnerable cached extractions
  • Restrict permissions on the ~/.cargo directory to prevent other local users from accessing it
  • Audit existing crate caches for files with world-writable permissions

Patch Information

The vulnerability has been addressed in Cargo version 0.72.2, bundled with Rust 1.71.1. The fix implements proper umask handling during archive extraction and includes an automatic cache purge mechanism that removes potentially compromised cached extractions from older Cargo versions.

Detailed patch information is available in the GitHub Security Advisory GHSA-j3xp-wfr4-hx87 and the corresponding GitHub Cargo Pull Request.

Fedora users should apply the relevant package updates announced via the Fedora Package Announcement.

Workarounds

  • Set restrictive permissions on the Cargo directory: chmod 700 ~/.cargo
  • Remove existing cached crates: rm -rf ~/.cargo/registry/src/
  • On shared systems, ensure the user's home directory is not accessible by other users
  • Consider using containerized build environments to isolate development dependencies
bash
# Configuration example
# Secure Cargo directory permissions
chmod 700 ~/.cargo

# Remove potentially compromised cache
rm -rf ~/.cargo/registry/src/

# Verify Cargo version after upgrade
cargo --version  # Should show 0.72.2 or later

# Scan for world-writable files in Cargo cache
find ~/.cargo -type f -perm -0002 -ls

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypePrivilege Escalation

  • Vendor/TechRust Lang Cargo

  • SeverityHIGH

  • CVSS Score7.3

  • EPSS Probability5.50%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityHigh
  • AvailabilityHigh
  • CWE References
  • CWE-278

  • CWE-732
  • Technical References
  • Wikipedia Umask Overview

  • GitHub CVE-2023-38497 Patch

  • Fedora Package Announcement

  • Fedora Package Announcement

  • Rust Language Security Policies
  • Vendor Resources
  • GitHub Cargo Commit Change

  • GitHub Cargo Pull Request

  • GitHub Security Advisory GHSA-j3xp-wfr4-hx87
  • Latest CVEs
  • CVE-2025-9185: Mozilla Firefox RCE Vulnerability

  • CVE-2025-9184: Mozilla Firefox RCE Vulnerability

  • CVE-2025-9180: Mozilla Firefox Auth Bypass Vulnerability

  • CVE-2025-8030: Mozilla Firefox RCE Vulnerability
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English