CVE-2021-29472
JSON

8.8high

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

Severity
8.8high CVSS:3.1 by GitHub_M
Exploit likelihood
4.75% (higher than 92% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-h5h8-pc6h-jvvxBIT-COMPOSER-2021-29472

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.

Affected

Product or packageVersionsReported by
composer composer< 1.10.22, >=2.0,<2.0.13CVE List
composer/composer (Packagist)before 1.10.22, from 2.0.0-alpha1 before 2.0.13GitHub Advisory Database
getcomposer composerbefore 1.10.22, from 2.0 before 2.0.13NVD
debian debian_linux9.0, 10.0NVD
fedoraproject fedora33, 34NVD
composer (Bitnami)before 1.10.22, from 2.0.0 before 2.0.13Bitnami Vulnerability Database

All scores

GitHub_M8.8high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
GitHub8.8high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
NVD8.8high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
NVD6.5medium CVSS:2.0AV:N/AC:L/Au:S/C:P/I:P/A:P
Bitnami Vulnerability Databasehigh rating

Classification

What each source says

CVE List

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.

GitHub Advisory Database

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.

NVD (es)

Composer es un administrador de dependencias para PHP.&#xa0;Las URL de los repositorios de Mercurial en la root composer.json y las URL de descarga de la fuente del paquete no se sanean correctamente.&#xa0;Los valores de URL específicamente diseñados permiten que el código se ejecute en HgDriver si hg/Mercurial está instalado en el sistema.&#xa0;El impacto para usuarios de Composer directamente es limitado ya que el archivo composer.json generalmente está bajo su propio control y las URL de descarga de origen solo pueden ser proporcionadas por repositorios de Composer de terceros en los que confían explícitamente para descargar y ejecutar el código fuente, por ejemplo, complementos de Composer.&#xa0;El principal impacto es en los servicios que pasan la entrada del usuario a Composer, incluidos Packagist.org y Private Packagist.&#xa0;Esto permitió a usuarios activar la ejecución remota de código.&#xa0;La vulnerabilidad se ha corregido en Packagist.&#xa0;org y Private Packagist dentro de las 12 horas posteriores a la recepción del informe de vulnerabilidad inicial y, en base a una revisión de los registros, hasta donde sabemos, nadie abusó de ella.&#xa0;Otros servicios y herramientas que usan VcsRepository/VcsDriver o derivados también pueden ser vulnerables y deberían actualizar su dependencia de compositor/compositor de inmediato.&#xa0;Las versiones 1.10.22 y 2.0.13 incluyen parches para este problema

References

https://github.com/composer/composer/security/advisories/GHSA-h5h8-pc6h-jvvxadvisory, third-party-advisory, web
https://getcomposer.org/advisory, vendor-advisory
https://www.debian.org/security/2021/dsa-4907advisory, third-party-advisory, vendor-advisory, web
https://lists.debian.org/debian-lts-announce/2021/05/msg00009.htmladvisory, mailing-list, third-party-advisory, web
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/FAQUAMGO4Q4BLNZ2OH4CXQD7UK4IO2GE/vendor-advisory, web
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/KN3DMFH42BJW45VT6FYF2RXKC26D6VC2/vendor-advisory, web
https://blog.sonarsource.com/php-supply-chain-attack-on-composer/advisory, exploit, third-party-advisory
https://nvd.nist.gov/vuln/detail/CVE-2021-29472advisory, web
https://blog.sonarsource.com/php-supply-chain-attack-on-composerweb
https://getcomposer.orgweb
https://github.com/FriendsOfPHP/security-advisories/blob/master/composer/composer/CVE-2021-29472.yamlweb
https://github.com/composer/composerpackage

Sources

SourceRecordLicence
CVE ListCVE-2021-29472 changed 2024-08-03CVE Terms of Use
GitHub Advisory DatabaseGHSA-h5h8-pc6h-jvvx changed 2026-07-08CC-BY-4.0
NVDCVE-2021-29472 changed 2026-06-17Public domain
Bitnami Vulnerability DatabaseBIT-COMPOSER-2021-29472 changed 2026-09-08Apache-2.0