Discover the details of CVE-2021-29472, a critical vulnerability in Composer for PHP that allows code execution via VCS repository URLs or source download URLs on systems with Mercurial.
A detailed overview of CVE-2021-29472, a vulnerability in Composer that can lead to code execution via VCS repository URLs or source download URLs when Mercurial is present.
Understanding CVE-2021-29472
This section sheds light on the impact, technical details, and mitigation strategies related to CVE-2021-29472.
What is CVE-2021-29472?
The vulnerability in Composer arises from incorrect sanitation of URLs for Mercurial repositories, enabling code execution in the HgDriver on systems with Mercurial installed. While direct impact on Composer users is limited, services passing user input to Composer are at risk, potentially leading to remote code execution.
The Impact of CVE-2021-29472
With a CVSS base score of 8.8 (High), this vulnerability poses significant risks in terms of confidentiality, integrity, and availability. Exploitation could result in remote code execution when specific URL values are crafted.
Technical Details of CVE-2021-29472
This section delves into the vulnerability description, affected systems, versions, and exploitation mechanism.
Vulnerability Description
Composer's failure to properly sanitize URLs for Mercurial repositories allows malicious actors to execute code in the HgDriver, particularly impacting services that provide user input to Composer, such as Packagist.org and Private Packagist.
Affected Systems and Versions
Versions less than 1.10.22 and between 2.0 and 2.0.13 are susceptible to this vulnerability. Users of Composer should ensure they have updated to the patched versions to mitigate the risk.
Exploitation Mechanism
Crafted URL values that trigger code execution in the HgDriver can be supplied by third-party Composer repositories that end-users explicitly trust. The exploit leverages the presence of Mercurial on the system.
Mitigation and Prevention
This section outlines immediate steps to take, long-term security practices, and the importance of timely patching and updates.
Immediate Steps to Take
Users and services utilizing Composer are urged to update to versions 1.10.22 and 2.0.13, which contain fixes for this vulnerability. Registrar services and users interacting with Composer should remain vigilant and apply patches promptly.
Long-Term Security Practices
As best practices, organizations should regularly update their Composer dependencies, verify the sources of URLs provided, and implement robust input validation to prevent malicious code execution.
Patching and Updates
Composer users should regularly check for updates and security advisories to ensure they are running the latest patched versions and safeguarding against potential exploits.