First published: Tue Apr 27 2021(Updated: )
Composer is a dependency manager for PHP. URLs for Mercurial repositories in the root composer.json and package source download URLs are not sanitized correctly. Specifically crafted URL values allow code to be executed in the HgDriver if hg/Mercurial is installed on the system. The impact to Composer users directly is limited as the composer.json file is typically under their own control and source download URLs can only be supplied by third party Composer repositories they explicitly trust to download and execute source code from, e.g. Composer plugins. The main impact is to services passing user input to Composer, including Packagist.org and Private Packagist. This allowed users to trigger remote code execution. The vulnerability has been patched on Packagist.org and Private Packagist within 12h of receiving the initial vulnerability report and based on a review of logs, to the best of our knowledge, was not abused by anyone. Other services/tools using VcsRepository/VcsDriver or derivatives may also be vulnerable and should upgrade their composer/composer dependency immediately. Versions 1.10.22 and 2.0.13 include patches for this issue.
Credit: security-advisories@github.com security-advisories@github.com
Affected Software | Affected Version | How to fix |
---|---|---|
composer/composer/composer | >=2.0.0-alpha1<2.0.13<1.10.22 | |
debian/composer | 1.8.4-1+deb10u2 1.8.4-1+deb10u1 2.0.9-2+deb11u1 2.5.5-1 2.6.5-1 | |
Getcomposer Composer | <1.10.22 | |
Getcomposer Composer | >=2.0<2.0.13 | |
Debian Debian Linux | =9.0 | |
Debian Debian Linux | =10.0 | |
Fedoraproject Fedora | =33 | |
Fedoraproject Fedora | =34 | |
composer/composer/composer | >=2.0.0-alpha1<2.0.13 | 2.0.13 |
composer/composer/composer | <1.10.22 | 1.10.22 |
Sign up to SecAlerts for real-time vulnerability data matched to your software, aggregated from hundreds of sources.
CVE-2021-29472 is a vulnerability in Composer, a dependency manager for PHP, that allows code execution via specially crafted URLs for Mercurial repositories.
CVE-2021-29472 allows code to be executed in the HgDriver if hg/Mercurial is installed on the system.
Versions from 2.0.0-alpha1 to 2.0.13, and versions from 1.10.0 to 1.10.22 of Composer are affected by CVE-2021-29472.
To fix CVE-2021-29472, you should upgrade Composer to a version that is not affected by the vulnerability.
You can find more information about CVE-2021-29472 in the following references: [GitHub Security Advisory](https://github.com/composer/composer/security/advisories/GHSA-h5h8-pc6h-jvvx), [SonarSource Blog](https://blog.sonarsource.com/php-supply-chain-attack-on-composer/), [Composer Official Website](https://getcomposer.org/).