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
    • 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-2024-24821

CVE-2024-24821: Composer Privilege Escalation Vulnerability

CVE-2024-24821 is a privilege escalation vulnerability in Getcomposer Composer that allows arbitrary code execution through tampered local files. This article covers technical details, affected versions, impact, and mitigation.

Updated: January 22, 2026

CVE-2024-24821 Overview

CVE-2024-24821 is a high-severity local code execution vulnerability in Composer, the widely-used dependency manager for PHP. The vulnerability allows arbitrary code execution through the inclusion of tampered files within the local working directory during Composer invocation. When Composer CLI commands are executed, several files from the project's vendor directory are loaded in the context of the executing user, enabling potential privilege escalation, lateral movement, or malicious code execution.

Critical Impact

This vulnerability affects all Composer CLI commands including composer.phar's self-update mechanism. Attackers who can modify files in the vendor/composer/ directory can achieve code execution with the privileges of the user running Composer, potentially leading to root privilege escalation when Composer is run with sudo.

Affected Products

  • Composer versions prior to 2.7.0
  • Composer versions prior to 2.2.23 (LTS branch)
  • All Composer CLI commands including self-update functionality

Discovery Timeline

  • 2024-02-09 - CVE-2024-24821 published to NVD
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2024-24821

Vulnerability Analysis

The vulnerability stems from Composer's automatic inclusion of files from the local working directory during execution. Specifically, the files vendor/composer/InstalledVersions.php and vendor/composer/installed.php are loaded and executed when any Composer command runs. This behavior is classified as CWE-829 (Inclusion of Functionality from Untrusted Control Sphere), where the application includes executable code from a source that may be outside the intended control sphere.

The attack requires local access to modify files within the project directory. Once malicious code is injected into the vulnerable files, it executes with the same privileges as the user running Composer. This is particularly dangerous in scenarios where Composer is executed with elevated privileges using sudo, potentially leading to full system compromise.

Root Cause

The root cause is the unconditional loading of PHP files from the vendor/composer/ directory without proper validation of their contents or origin. The Composer runtime trusts these files implicitly, assuming they contain legitimate package metadata generated by Composer itself. This trust assumption can be violated in shared environments or when working with untrusted project sources.

The security patch addresses this by introducing additional validation through the FilesystemRepository class, implementing proper checks using the Composer\Pcre\Preg module to sanitize and validate file contents before inclusion.

Attack Vector

The attack requires local access (AV:L) with low privileges (PR:L) and no user interaction (UI:N). High-risk scenarios include:

  • Sudo Execution: Running Composer with sudo privileges allows attackers to escalate to root
  • CI/CD Pipelines: Automated pipelines executing Composer on untrusted projects may execute malicious code
  • Shared Development Environments: Multiple developers sharing the same project directory can exploit each other's Composer executions
php
// Security patch excerpt from src/Composer/Factory.php
// Adding FilesystemRepository for secure file handling
use Composer\Package\Archiver;
use Composer\Package\Version\VersionGuesser;
use Composer\Package\RootPackageInterface;
+use Composer\Repository\FilesystemRepository;
use Composer\Repository\RepositoryManager;
use Composer\Repository\RepositoryFactory;
use Composer\Util\Filesystem;

Source: GitHub Commit 64e4eb3

php
// Security patch excerpt from src/Composer/Repository/FilesystemRepository.php
// Adding Preg module for input validation
use Composer\Package\AliasPackage;
use Composer\Package\Dumper\ArrayDumper;
use Composer\Installer\InstallationManager;
+use Composer\Pcre\Preg;
use Composer\Util\Filesystem;
use Composer\Util\Platform;

Source: GitHub Commit 64e4eb3

Detection Methods for CVE-2024-24821

Indicators of Compromise

  • Unexpected modifications to vendor/composer/InstalledVersions.php or vendor/composer/installed.php files
  • PHP files in the vendor/composer directory containing suspicious code patterns such as eval(), exec(), system(), or base64-encoded strings
  • Unusual process spawning from PHP processes executing Composer commands
  • File integrity changes in the vendor directory not associated with legitimate dependency updates

Detection Strategies

  • Implement file integrity monitoring (FIM) on vendor/composer/InstalledVersions.php and vendor/composer/installed.php files
  • Monitor for Composer processes spawning unexpected child processes or network connections
  • Audit sudo command logs for Composer executions with elevated privileges
  • Review CI/CD pipeline logs for Composer commands executed on untrusted or external repositories

Monitoring Recommendations

  • Configure security monitoring to alert on any changes to files in the vendor/composer/ directory outside of normal dependency update operations
  • Monitor for PHP file modifications in project directories by users other than the project owner
  • Implement process behavior analysis to detect anomalous activity following Composer command execution
  • Enable audit logging for all sudo command executions to track privileged Composer usage

How to Mitigate CVE-2024-24821

Immediate Actions Required

  • Upgrade Composer to version 2.7.0 or later (or 2.2.23 for the LTS branch) immediately
  • Remove all sudo privileges for Composer commands across all users to mitigate root privilege escalation risk
  • Audit existing Composer installations and verify the integrity of vendor/composer/InstalledVersions.php and vendor/composer/installed.php files
  • Avoid running Composer within untrusted directories or on projects from unknown sources

Patch Information

The vulnerability has been addressed in Composer versions 2.7.0 and 2.2.23. The security patch introduces proper file validation through the FilesystemRepository class and implements content sanitization using the Composer\Pcre\Preg module. Organizations should apply the patched versions at the earliest convenience. For technical details, refer to the GitHub Security Advisory GHSA-7c6p-848j-wh5h and the official patch commit.

Workarounds

  • Remove sudo Composer privileges for all users to prevent root privilege escalation
  • Verify contents of vendor/composer/InstalledVersions.php and vendor/composer/installed.php do not include untrusted code before running Composer
  • Reset potentially compromised files by removing and regenerating them using the commands below
  • Implement strict access controls on project directories in shared development environments
  • Review and sanitize all project files before running Composer on externally sourced code
bash
# Reset potentially compromised vendor files
rm vendor/composer/installed.php vendor/composer/InstalledVersions.php
composer install --no-scripts --no-plugins

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

  • Vulnerability Details
  • TypePrivilege Escalation

  • Vendor/TechGetcomposer

  • SeverityHIGH

  • CVSS Score7.8

  • EPSS Probability0.09%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-829
  • Technical References
  • GitHub Security Advisory GHSA-7c6p-848j-wh5h
  • Vendor Resources
  • GitHub Commit Update
  • Related CVEs
  • CVE-2022-24828: Composer Dependency Manager RCE Vulnerability

  • CVE-2021-41116: Getcomposer Composer RCE Vulnerability

  • CVE-2021-29472: Composer Dependency Manager RCE Vulnerability
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