CVE-2021-29472: Missing argument delimiter can lead to code execution via VCS repository URLs or source download URLs on systems with Mercurial in composer

Published 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.

Other sources

Missing argument delimiter can lead to command execution via VCS repository URLs or source download URLs on systems with Mercurial

URLs for Mercurial repositories in the root composer.json and package source download URLs are not sanitized correctly. Specifically crafted URL values allow commands to be executed in the HgDriver if hg/Mercurial is installed on the system.

Impact - 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 command injection. 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

Patches 1.10.22 and 2.0.13 include patches for this issue.

GitHub

Affected Software

10 affected componentsFixes available
composer/composer/composer>=2.0.0-alpha1, <2.0.13, <1.10.22
debian/composer
1.8.4-1+deb10u21.8.4-1+deb10u12.0.9-2+deb11u12.5.5-12.6.5-1
composer/composer/composer>=2.0.0-alpha1<2.0.13
2.0.13
composer/composer/composer<1.10.22
1.10.22
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

Event History

Apr 27, 2021
Advisory Published
11:10 AM
CVE Published
via MITRE·08:30 PM
Data Sourced
via MITRE·08:30 PM
DescriptionSeverityWeakness
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is CVE-2021-29472?

CVE-2021-29472 is a vulnerability in Composer, a dependency manager for PHP, that allows code execution via specially crafted URLs for Mercurial repositories.

2

How does CVE-2021-29472 impact Composer?

CVE-2021-29472 allows code to be executed in the HgDriver if hg/Mercurial is installed on the system.

3

Which versions of Composer are affected by CVE-2021-29472?

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.

4

How can I fix CVE-2021-29472 in Composer?

To fix CVE-2021-29472, you should upgrade Composer to a version that is not affected by the vulnerability.

5

Where can I find more information about CVE-2021-29472?

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/).

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203