CVE-2021-29472 Composer's missing argument delimiter can lead to code execution via VCS repository URLs or source download URLs on systems with Mercurial
Attackers can execute arbitrary code via crafted Mercurial URLs in Composer, primarily affecting services like Packagist that process user-supplied inputs.
- Exploited in the wild
- Not known
- Login needed
- Any signed-in user
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2021-29472?
CVE-2021-29472 is a high-severity command injection vulnerability in Debian Debian Linux, published on 27 Apr 2021. Any signed-in user can exploit it over the network, with no action from the victim.
Official description
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.
Which versions are affected by CVE-2021-29472?
5 open source packages ship an affected version, including composer/composer and composer. It affects 3 products.
| Package | Affected | Fixed in |
|---|---|---|
composer/composer Packagist | All versions | 1.10.22 |
composer/composer Packagist | All versions | 1.10.22 |
composer/composer Packagist | From 2.0.0-alpha1 | 2.0.13 |
composer/composer Packagist | From 2.0.0-alpha1 | 2.0.13 |
composer Bitnami | All versions | 1.10.22, 2.0.13 |
Linux distribution packages (6)
php-composer SUSE:Package Hub 15 SP1 | All versions | 1.10.22-bp153.2.3.1 |
php-composer SUSE:Package Hub 15 SP2 | All versions | 1.10.22-bp153.2.3.1 |
php-composer SUSE:Package Hub 15 SP3 | All versions | 1.10.22-bp153.2.3.1 |
php-composer openSUSE:Leap 15.2 | All versions | 1.10.22-bp153.2.3.1 |
php-composer openSUSE:Leap 15.3 | All versions | 1.10.22-bp153.2.3.1 |
php-composer openSUSE:Tumbleweed | All versions | 1.10.22-2.2 |
Products include Debian Debian Linux, Fedoraproject Fedora, Getcomposer Composer.
How do I fix CVE-2021-29472?
Upgrade composer/composer to a fixed version for your release line: 1.10.22 or 2.0.13.
Upgrade, and pass arguments to programs as a list instead of through a shell. More about Command injection.
Is CVE-2021-29472 being exploited?
There is no known exploitation of CVE-2021-29472 in the wild and no public exploit code.
Other vulnerabilities in Debian Debian Linux
Sources
Also known as BIT-composer-2021-29472, CLEANSTART-2024-XJ18859, DEBIAN-CVE-2021-29472, DLA-2654-1, DSA-4907-1, GHSA-h5h8-pc6h-jvvx and 4 more.