A Leader in the 2026 Gartner® Magic Quadrant™ for Endpoint Protection. Six years running.Six years. Gartner® Magic Quadrant™ Leader.Find Out Why
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-2024-35242

CVE-2024-35242: Composer for PHP RCE Vulnerability

CVE-2024-35242 is a command injection vulnerability in Composer for PHP that enables remote code execution through malicious git/hg branch names. This article covers technical details, affected versions, and mitigation.

Published: June 16, 2026

CVE-2024-35242 Overview

CVE-2024-35242 is a command injection vulnerability in Composer, the dependency manager for PHP. The flaw affects versions on the 2.x branch prior to 2.2.24 and 2.7.7. When composer install runs inside a Git or Mercurial repository, a specially crafted branch name is passed unsanitized into a shell command line. An attacker who controls a repository can trigger arbitrary command execution on the developer or CI host that clones and installs it. The issue is tracked under [CWE-77: Command Injection] and is documented in the GitHub Security Advisory GHSA-v9qv-c7wm-wgmf.

Critical Impact

Cloning and installing an untrusted PHP project can lead to arbitrary command execution on the host running Composer, enabling supply-chain compromise of developer workstations and CI/CD runners.

Affected Products

  • Composer 2.x branch prior to 2.2.24 (2.2 LTS)
  • Composer 2.x branch prior to 2.7.7 (mainline)
  • Fedora packages of Composer covered by the Fedora package announcement

Discovery Timeline

  • 2024-06-10 - CVE-2024-35242 published to the National Vulnerability Database
  • 2026-04-15 - Last updated in NVD database

Technical Details for CVE-2024-35242

Vulnerability Analysis

The vulnerability resides in src/Composer/Package/Version/VersionGuesser.php. When Composer attempts to determine the version of a feature branch, it shells out to git rev-list using a string template that includes branch names. Branch names in Git and Mercurial may contain shell metacharacters, and Composer historically interpolated them into a single command string passed to a shell. An attacker who publishes a repository containing a branch with a name such as $(payload) can have that payload executed by the shell that Composer spawns. Exploitation requires the victim to clone the malicious repository and run composer install, which is a routine workflow in PHP development and continuous integration.

Root Cause

The VersionGuesser component built a command string by substituting %candidate% and %branch% tokens directly into 'git rev-list %candidate%..%branch%'. The resulting string was executed through a shell, so any shell metacharacters present in the branch name were interpreted rather than treated as literal arguments. This is a classic argument-versus-string command construction flaw [CWE-77].

Attack Vector

The attack vector is network-based but requires user interaction in the form of cloning an untrusted repository. Typical scenarios include a developer evaluating a third-party project, a CI job that clones a forked pull request, or any automated pipeline that runs composer install against attacker-controlled source. The injected command runs with the privileges of the user invoking Composer.

php
                $featurePrettyVersion = $prettyVersion;

                // try to find the best (nearest) version branch to assume this feature's version
-                $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'git rev-list %candidate%..%branch%', $path);
+                $result = $this->guessFeatureVersion($packageConfig, $version, $branches, ['git', 'rev-list', '%candidate%..%branch%'], $path);
                $version = $result['version'];
                $prettyVersion = $result['pretty_version'];

Source: composer/composer commit 6bd43dff. The patch converts the command from a shell string into an argv array, so branch names are passed as discrete arguments to git and are never reinterpreted by the shell. A complementary fix in the 2.2 LTS branch adds the -- separator to prevent option injection, shown in commit fc57b936.

Detection Methods for CVE-2024-35242

Indicators of Compromise

  • Git or Mercurial branch references containing shell metacharacters such as $(, backticks, ;, |, or && in .git/refs/heads or .git/packed-refs.
  • Unexpected child processes spawned by php or composer during composer install, particularly shells, network utilities such as curl, wget, or nc, or interpreters such as bash -c.
  • Outbound connections from CI runners or developer workstations originating from a Composer process tree shortly after repository clone.

Detection Strategies

  • Hunt EDR telemetry for process lineages where composer or php spawn /bin/sh -c with arguments containing branch-like tokens. Behavioral AI engines such as those in Singularity Endpoint surface these anomalous developer-tool process trees.
  • Inspect repositories before installation using git for-each-ref --format='%(refname)' and flag refs containing characters outside [A-Za-z0-9._/-].
  • Centralize CI logs into a SIEM and alert on Composer exit codes accompanied by unexpected child process names. The Singularity Data Lake can normalize CI and endpoint telemetry through OCSF for cross-source correlation.

Monitoring Recommendations

  • Monitor composer install invocations on shared build infrastructure and capture full command lines and parent-child process relationships.
  • Track installations of Composer package versions across developer endpoints and reject any host still running Composer below 2.2.24 or 2.7.7.
  • Alert on first-time outbound network destinations from CI runners during the dependency-resolution phase of builds.

How to Mitigate CVE-2024-35242

Immediate Actions Required

  • Upgrade Composer to 2.2.24 on the 2.2 LTS branch or 2.7.7 on mainline across all developer workstations, container images, and CI runners.
  • Rebuild and republish any base images that embed Composer so downstream pipelines pull a patched binary.
  • Audit recent CI runs that cloned external or fork-based repositories for unexpected processes or outbound connections.

Patch Information

Fixes are provided in upstream commits 6bd43dff and fc57b936, both linked from GHSA-v9qv-c7wm-wgmf. Distribution updates are available via the Fedora package announcements (PO4MU2BC and VLPJHM2W).

Workarounds

  • Avoid cloning repositories from untrusted sources until Composer is upgraded.
  • Run composer install only inside ephemeral, network-restricted sandboxes for unverified projects.
  • Restrict CI jobs that build pull requests from forks to run with minimal credentials and no write access to internal artifact stores.
bash
# Upgrade Composer to a patched release
composer self-update 2.7.7
# Or for the 2.2 LTS branch
composer self-update 2.2.24

# Verify the installed version
composer --version

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

  • Vulnerability Details
  • TypeRCE

  • Vendor/TechComposer

  • SeverityHIGH

  • CVSS Score8.8

  • EPSS Probability3.26%

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

  • GitHub Commit Update

  • GitHub Security Advisory

  • Fedora Package Announcement

  • Fedora Package Announcement
  • Related CVEs
  • CVE-2026-40261: Composer Command Injection RCE Vulnerability

  • CVE-2026-40176: Composer Command Injection RCE Vulnerability

  • CVE-2024-35241: Composer for PHP RCE Vulnerability
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today 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