Vulnerability · Published Jun 10, 2024 · Assigned by GitHub_M
CVE-2024-35242Composer vulnerable to command injection via malicious git/hg branch names
High 8.8
In plain English
A high-severity command injection in composer from composer. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 3.3% (higher than 89% of all known vulnerabilities). Ready-made attack tooling exists: public proof-of-concept code. Fixed versions are available - upgrade the affected package.
Official description
Composer is a dependency manager for PHP. On the 2.x branch prior to versions 2.2.24 and 2.7.7, the `composer install` command running inside a git/hg repository which has specially crafted branch names can lead to command injection. This requires cloning untrusted repositories. Patches are available in version 2.2.24 for 2.2 LTS or 2.7.7 for mainline. As a workaround, avoid cloning potentially compromised repositories.
Affected packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| Alpine:v3.20 | composer | 2.7.7-r0 | ALPINE-CVE-2024-35242 |
| Alpine:v3.21 | composer | 2.7.7-r0 | ALPINE-CVE-2024-35242 |
| Alpine:v3.22 | composer | 2.7.7-r0 | ALPINE-CVE-2024-35242 |
| Alpine:v3.23 | composer | 2.7.7-r0 | ALPINE-CVE-2024-35242 |
| Alpine:v3.24 | composer | 2.7.7-r0 | ALPINE-CVE-2024-35242 |
| Debian:12 | composer | 2.5.5-1+deb12u2 | DSA-5715-1 |
| Debian:12 | composer | 2.5.5-1+deb12u2 | DEBIAN-CVE-2024-35242 |
| Debian:13 | composer | 2.7.7-1 | DEBIAN-CVE-2024-35242 |
| Debian:14 | composer | 2.7.7-1 | DEBIAN-CVE-2024-35242 |
| Packagist | composer/composer | 2.2.24 | GHSA-v9qv-c7wm-wgmf |
| Packagist | composer/composer | 2.7.7 | GHSA-v9qv-c7wm-wgmf |
Affected products (as reported)
Weakness: CWE-77 · Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
References
- https://github.com/composer/composer/security/advisories/GHSA-v9qv-c7wm-wgmf x_refsource_CONFIRM
- https://github.com/composer/composer/commit/6bd43dff859c597c09bd03a7e7d6443822d0a396 x_refsource_MISC
- https://github.com/composer/composer/commit/fc57b93603d7d90b71ca8ec77b1c8a9171fdb467 x_refsource_MISC
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/VLPJHM2WWSYU2F6KHW2BYFGYL4IGTKHC/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/PO4MU2BC7VR6LMHEX4X7DKGHVFXZV2MC/