CVE-2024-35242Composer vulnerable to command injection via malicious git/hg branch names
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.
What to do
Fixed builds are available from Alpine, Debian, Packagist: see the table below for the fixed version per release.
Ubuntu has not shipped a fix for every release yet.
Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.
curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \ -H "Content-Type: text/plain" --data-binary @inventory.txt
Vendor status at a glance
Status by vendor and release
From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 26.04 | composer | Not affected vulnerable_code_not_present | ||
| Ubuntu 25.10 | composer | Not affected vulnerable_code_not_present | ||
| Ubuntu 24.04 | composer | Fix pending | 2.7.1-2ubuntu0.1~esm1 (Ubuntu Pro) | UBUNTU-CVE-2024-35242 |
| Ubuntu 22.04 | composer | Fix pending | 2.2.6-2ubuntu4+esm1 (Ubuntu Pro) | UBUNTU-CVE-2024-35242 |
| Ubuntu 20.04 | composer | Fix pending | 1.10.1-1ubuntu0.1~esm2 (Ubuntu Pro) | UBUNTU-CVE-2024-35242 |
| Ubuntu 18.04 | composer | Fix pending | 1.6.3-1ubuntu0.1~esm2 (Ubuntu Pro) | UBUNTU-CVE-2024-35242 |
| Ubuntu 16.04 | composer | Fix pending | 1.0.0~beta2-1ubuntu0.1~esm2 (Ubuntu Pro) | UBUNTU-CVE-2024-35242 |
| Debian 14 | composer | Fixed | 2.7.7-1 | DEBIAN-CVE-2024-35242 |
| Debian 13 | composer | Fixed | 2.7.7-1 | DEBIAN-CVE-2024-35242 |
| Debian 12 | composer | Fixed | 2.5.5-1+deb12u2 | DEBIAN-CVE-2024-35242 |
| Alpine Linux 3.24 | composer | Fixed | 2.7.7-r0 | ALPINE-CVE-2024-35242 |
| Alpine Linux 3.23 | composer | Fixed | 2.7.7-r0 | ALPINE-CVE-2024-35242 |
| Alpine Linux 3.22 | composer | Fixed | 2.7.7-r0 | ALPINE-CVE-2024-35242 |
| Alpine Linux 3.21 | composer | Fixed | 2.7.7-r0 | ALPINE-CVE-2024-35242 |
| Alpine Linux 3.20 | composer | Fixed | 2.7.7-r0 | ALPINE-CVE-2024-35242 |
| Alpine Linux 3.19 | composer | Fixed | 2.7.7-r0 | ALPINE-CVE-2024-35242 |
| Packagist library | composer/composer | Fixed | 2.7.7 | GHSA-v9qv-c7wm-wgmf |
What the vendor says
As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.
- composer: affected: >= 2.0, < 2.2.24, >= 2.3, < 2.7.7
References
- https://github.com/composer/composer/security/advisories/GHSA-v9qv-c7wm-wgmf
- https://github.com/composer/composer/commit/6bd43dff859c597c09bd03a7e7d6443822d0a396
- https://github.com/composer/composer/commit/fc57b93603d7d90b71ca8ec77b1c8a9171fdb467
- 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/
About this page
Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.