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-2021-29472

CVE-2021-29472: Composer Dependency Manager RCE Vulnerability

CVE-2021-29472 is a remote code execution vulnerability in Composer dependency manager for PHP that allows attackers to execute code through crafted Mercurial repository URLs. This article covers technical details, affected versions, impact, and mitigation steps.

Published: February 25, 2026

CVE-2021-29472 Overview

CVE-2021-29472 is a command injection vulnerability in Composer, the widely-used dependency manager for PHP. The vulnerability exists due to improper sanitization of URLs for Mercurial repositories specified in composer.json files and package source download URLs. When Mercurial (hg) is installed on the target system, specially crafted URL values can execute arbitrary code through the HgDriver component.

While the direct impact to individual Composer users is somewhat limited—since the composer.json file is typically under their own control—the vulnerability poses significant risk to services that process user-supplied input, such as Packagist.org and Private Packagist. These services were promptly patched within 12 hours of the initial vulnerability report.

Critical Impact

Remote code execution vulnerability affecting PHP supply chain infrastructure. Attackers can execute arbitrary commands on systems running vulnerable Composer versions when processing malicious Mercurial repository URLs.

Affected Products

  • Composer versions prior to 1.10.22
  • Composer versions 2.x prior to 2.0.13
  • Debian Linux 9.0 and 10.0
  • Fedora 33 and 34

Discovery Timeline

  • 2021-04-27 - CVE-2021-29472 published to NVD
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2021-29472

Vulnerability Analysis

This vulnerability is classified under CWE-88 (Improper Neutralization of Argument Delimiters in a Command). The root cause lies in the HgDriver component's failure to properly sanitize repository URLs before passing them to shell commands. When Composer processes a malicious Mercurial repository URL, the unsanitized input allows injection of additional command arguments or shell metacharacters.

The vulnerability affects any service or tool that utilizes Composer's VcsRepository or VcsDriver components, making it particularly dangerous in automated CI/CD pipelines and package registry services. The attack surface extends beyond direct Composer usage to any PHP application that programmatically interacts with Composer's repository handling functionality.

Root Cause

The vulnerability stems from insufficient input validation in Composer's Mercurial driver. When processing repository URLs, the HgDriver passes user-controlled URL strings to system shell commands without proper escaping or sanitization. This allows an attacker to craft malicious URLs containing shell metacharacters or additional command arguments that execute when Composer attempts to interact with the supposed Mercurial repository.

Attack Vector

The attack requires network access and is executed through specially crafted Mercurial repository URLs. An attacker can exploit this vulnerability through several vectors:

  1. Malicious Package Submission: Submitting a package with a crafted repository URL to services like Packagist
  2. Compromised composer.json: Including malicious URLs in a composer.json file that targets systems with Mercurial installed
  3. Third-Party Repository Poisoning: Exploiting trust relationships with third-party Composer repositories

The attacker crafts a URL that, when processed by the HgDriver, results in command injection. This is possible because Mercurial is invoked with the attacker-controlled URL as an argument, and insufficient sanitization allows shell escape sequences or argument injection.

For detailed technical analysis of this supply chain attack vector, see the SonarSource Blog on Composer Attack.

Detection Methods for CVE-2021-29472

Indicators of Compromise

  • Unusual Mercurial (hg) process executions initiated by PHP or Composer processes
  • Suspicious command-line arguments containing shell metacharacters in hg process invocations
  • Unexpected network connections originating from Composer operations
  • Modified composer.json files with suspicious Mercurial repository URLs containing special characters

Detection Strategies

  • Monitor process execution chains for PHP or Composer spawning unexpected child processes
  • Implement file integrity monitoring on composer.json files across repositories
  • Audit Composer dependency update logs for unusual repository URL patterns
  • Configure SIEM rules to detect hg command executions with suspicious argument patterns

Monitoring Recommendations

  • Enable verbose logging for Composer operations in production environments
  • Implement network segmentation to isolate CI/CD systems that run Composer
  • Deploy endpoint detection solutions capable of monitoring command injection patterns
  • Regularly audit third-party Composer repository configurations for unauthorized sources

How to Mitigate CVE-2021-29472

Immediate Actions Required

  • Upgrade Composer to version 1.10.22 or later for 1.x installations
  • Upgrade Composer to version 2.0.13 or later for 2.x installations
  • Audit existing composer.json files for suspicious Mercurial repository URLs
  • Consider temporarily removing Mercurial from systems where it is not required
  • Review and restrict third-party Composer repository configurations

Patch Information

The vulnerability has been addressed in Composer versions 1.10.22 and 2.0.13. Users should update their Composer installations immediately. For systems using package manager distributions, security updates are available:

  • Debian: Security advisory DSA-4907 provides patched packages
  • Fedora: Updated packages available via Fedora Package Announcements

For complete details, review the GitHub Security Advisory GHSA-h5h8-pc6h-jvvx.

Workarounds

  • Remove or disable Mercurial (hg) from systems where it is not essential to operations
  • Implement strict validation on any user input that could reach Composer repository configurations
  • Use allowlists for permitted repository URLs in environments processing external packages
  • Deploy web application firewalls (WAF) to filter malicious repository URL patterns in services accepting Composer configurations
bash
# Upgrade Composer to patched version
composer self-update --2
# Verify Composer version
composer --version
# For systems using Debian package manager
sudo apt update && sudo apt install --only-upgrade composer

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

  • Vulnerability Details
  • TypeRCE

  • Vendor/TechGetcomposer

  • SeverityHIGH

  • CVSS Score8.8

  • EPSS Probability3.58%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-88
  • Technical References
  • SonarSource Blog on Composer Attack

  • GitHub Security Advisory GHSA-h5h8-pc6h-jvvx

  • Debian LTS Announcement May 2021

  • Fedora Package Announcement

  • Fedora Package Announcement

  • Debian Security DSA-4907
  • Vendor Resources
  • Composer Official Website
  • Related CVEs
  • CVE-2022-24828: Composer Dependency Manager RCE Vulnerability

  • CVE-2021-41116: Getcomposer Composer RCE Vulnerability

  • CVE-2024-24821: Composer Privilege Escalation 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