cbcvebase.
CVE-2021-29472
published 2021-04-27

CVE-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
VendorProductVersion rangeFixed in
composercomposer< 1.10.221.10.22
composercomposer
composercomposer>= 0 < 2.0.9-22.0.9-2
composercomposer>= 0 < 2.0.9-22.0.9-2
composercomposer>= 0 < 2.0.9-22.0.9-2
composercomposer>= 0 < 2.0.9-22.0.9-2
composercomposer>= 0 < 1.10.221.10.22
composercomposer>= 2.0.0-alpha1 < 2.0.132.0.13
debiancomposer< composer 2.0.9-2 (bookworm)composer 2.0.9-2 (bookworm)
debiandebian_linux
debiandebian_linux
fedoraprojectfedora
fedoraprojectfedora
getcomposercomposer< 1.10.221.10.22
getcomposercomposer>= 2.0 < 2.0.132.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.