CVE-2021-29472
published 2021-04-27CVE-2021-29472: Composer is a dependency manager for PHP. URLs for Mercurial repositories in the root composer.json and package source download URLs are not sanitized…
PriorityP263high8.8CVSS 3.1
AVNACLPRLUINSUCHIHAH
EPSS
4.85%
90.9th percentile
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.
Affected
15 ranges
| Vendor | Product | Version range | Fixed in |
|---|---|---|---|
| composer | composer | < 1.10.22 | 1.10.22 |
| composer | composer | — | — |
| composer | composer | >= 0 < 2.0.9-2 | 2.0.9-2 |
| composer | composer | >= 0 < 2.0.9-2 | 2.0.9-2 |
| composer | composer | >= 0 < 2.0.9-2 | 2.0.9-2 |
| composer | composer | >= 0 < 2.0.9-2 | 2.0.9-2 |
| composer | composer | >= 0 < 1.10.22 | 1.10.22 |
| composer | composer | >= 2.0.0-alpha1 < 2.0.13 | 2.0.13 |
| debian | composer | < composer 2.0.9-2 (bookworm) | composer 2.0.9-2 (bookworm) |
| debian | debian_linux | — | — |
| debian | debian_linux | — | — |
| fedoraproject | fedora | — | — |
| fedoraproject | fedora | — | — |
| getcomposer | composer | < 1.10.22 | 1.10.22 |
| getcomposer | composer | >= 2.0 < 2.0.13 | 2.0.13 |
Detection & IOCsextracted from sources · hover to see the quote
- →Exploitation targets the HgDriver component in Composer when hg/Mercurial is installed on the system — monitor for unexpected `hg` process spawns initiated by the PHP/Composer process tree as a sign of exploitation. ↗
- →Audit services that pass user-supplied input to Composer's VcsRepository/VcsDriver or any derivative classes, as these are the attack surface for remote code execution via malicious URL values. ↗
- →Inspect composer.json files (especially root composer.json) and package source download URLs supplied by third-party Composer repositories for anomalous or shell-metacharacter-containing Mercurial repository URLs. ↗
- ·Exploitation requires hg/Mercurial to be installed on the target system; environments without Mercurial are not vulnerable to code execution via this vector. ↗
- ·Patched versions are Composer 1.10.22 and 2.0.13; upgrade immediately to remediate. ↗
CVSS provenance
nvdv3.18.8HIGHCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
nvdv2.06.5MEDIUMAV:N/AC:L/Au:S/C:P/I:P/A:P
osv8.8HIGH
vendor_debian8.8HIGH
Stop checking back — get the weekly exploitation signal.
Every Monday: what got weaponized or added to CISA KEV in the last seven days — each CVE cross-linked to its PoC, Nuclei template, and detection rule. Free, one email a week, unsubscribe in one click.
Ubuntu
Composer vulnerability
vendor_ubuntu·2022-07-08
CVE-2021-29472 Composer vulnerability
Title: Composer vulnerability
Summary: Composer could be made to run programs if it received specially crafted
URL values.
It was discovered that Composer did not properly sanitize URLs for
Mercurial repositories in the root composer.json and package source
download URLs. A remote attacker could possibly use this issue to execute
arbitrary code.
Instructions: In general, a standard system update will make all the necessary changes.
Debian
CVE-2021-29472: composer - Composer is a dependency manager for PHP. URLs for Mercurial repositories in the...
vendor_debian·2021·CVSS 8.8
CVE-2021-29472 [HIGH] CVE-2021-29472: composer - Composer is a dependency manager for PHP. URLs for Mercurial repositories in the...
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 w
GHSA
Composer's missing argument delimiter can lead to code execution via VCS repository URLs or source download URLs on systems with Mercurial
ghsa·2021-04-29
CVE-2021-29472 [HIGH] CWE-88 Composer's missing argument delimiter can lead to code execution via VCS repository URLs or source download URLs on systems with Mercurial
Composer's missing argument delimiter can lead to code 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 allow
OSV
Composer's missing argument delimiter can lead to code execution via VCS repository URLs or source download URLs on systems with Mercurial
osv·2021-04-29
CVE-2021-29472 [HIGH] Composer's missing argument delimiter can lead to code execution via VCS repository URLs or source download URLs on systems with Mercurial
Composer's missing argument delimiter can lead to code 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 allow
OSV
CVE-2021-29472: Composer is a dependency manager for PHP
osv·2021-04-27·CVSS 8.8
CVE-2021-29472 [HIGH] CVE-2021-29472: Composer is a dependency manager for PHP
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 w
No detection rules found.
No public exploits indexed.
No writeups or analysis indexed.
https://blog.sonarsource.com/php-supply-chain-attack-on-composer/https://getcomposer.org/https://github.com/composer/composer/security/advisories/GHSA-h5h8-pc6h-jvvxhttps://lists.debian.org/debian-lts-announce/2021/05/msg00009.htmlhttps://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/FAQUAMGO4Q4BLNZ2OH4CXQD7UK4IO2GE/https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/KN3DMFH42BJW45VT6FYF2RXKC26D6VC2/https://www.debian.org/security/2021/dsa-4907https://blog.sonarsource.com/php-supply-chain-attack-on-composer/https://getcomposer.org/https://github.com/composer/composer/security/advisories/GHSA-h5h8-pc6h-jvvxhttps://lists.debian.org/debian-lts-announce/2021/05/msg00009.htmlhttps://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/FAQUAMGO4Q4BLNZ2OH4CXQD7UK4IO2GE/https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/KN3DMFH42BJW45VT6FYF2RXKC26D6VC2/https://www.debian.org/security/2021/dsa-4907
2021-04-27
Published