Composer vulnerable to command injection via malicious git branch name
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- Required
- Attack complexity
- Low
- Impact type
- Code execution
- Confidentiality · integrity · availability
- High · High · High
- Fix status
- Fixed
Attack profile from CVSS 3.1 · CNA. Fix status from CNA and GitHub. Impact type from CWE-77.
Summary
Composer is a dependency manager for PHP. On the 2.x branch prior to versions 2.2.24 and 2.7.7, the `status`, `reinstall` and `remove` commands with packages installed from source via git containing specially crafted branch names in the repository can be used to execute code. Patches for this issue are available in version 2.2.24 for 2.2 LTS or 2.7.7 for mainline. As a workaround, avoid installing dependencies via git by using `--prefer-dist` or the `preferred-install: dist` config setting.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- None
- Automatable
- No
- Technical impact
- Total
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| composer | composer | 2.0 to before 2.2.24; 2.3 to before 2.7.7 | 2.2.24, 2.7.7 | Patch available | CNA |
| — | composer/composer (Packagist) | 2.0 to before 2.2.24 | 2.2.24 | Patch available | GHSA-47f6-5gq3-vx9c |
| — | composer/composer (Packagist) | 2.3 to before 2.7.7 | 2.7.7 | Patch available | GHSA-47f6-5gq3-vx9c |
- composer Vendorcomposer Affected 2.0 to before 2.2.24; 2.3 to before 2.7.7 Fixed in 2.2.24, 2.7.7 Patch available CNA
- composer/composer (Packagist) Vendor— Affected 2.0 to before 2.2.24 Fixed in 2.2.24 Patch available GHSA-47f6-5gq3-vx9c
- composer/composer (Packagist) Vendor— Affected 2.3 to before 2.7.7 Fixed in 2.7.7 Patch available GHSA-47f6-5gq3-vx9c
CPE names CISA-ADP · 4
| CPE | Versions | Role | Vendor |
|---|---|---|---|
| cpe:2.3:o:fedoraproject:fedora:39:*:*:*:*:*:*:* | 39 | — | Fedoraproject |
| cpe:2.3:o:fedoraproject:fedora:40:*:*:*:*:*:*:* | 40 | — | Fedoraproject |
| cpe:2.3:a:getcomposer:composer:2.0:*:*:*:*:*:*:* | 2.0 | — | composer |
| cpe:2.3:a:getcomposer:composer:2.3:*:*:*:*:*:*:* | 2.3 | — | composer |
- cpe:2.3:o:fedoraproject:fedora:39:*:*:*:*:*:*:* Versions 39 — ·Fedoraproject
- cpe:2.3:o:fedoraproject:fedora:40:*:*:*:*:*:*:* Versions 40 — ·Fedoraproject
- cpe:2.3:a:getcomposer:composer:2.0:*:*:*:*:*:*:* Versions 2.0 — ·composer
- cpe:2.3:a:getcomposer:composer:2.3:*:*:*:*:*:*:* Versions 2.3 — ·composer
Remediation
- Fix · CNA composer (composer) Fixed in 2.2.24, 2.7.7
- Fix · GHSA-47f6-5gq3-vx9c composer/composer (Packagist) Fixed in 2.2.24 Advisory →
- Fix · GHSA-47f6-5gq3-vx9c composer/composer (Packagist) Fixed in 2.7.7 Advisory →
Vendor assessments
Timeline
- 2026-10-02 Threatist record created from CVE-2024-35241
- 2026-10-03 Alias added: GHSA-47f6-5gq3-vx9c
References
Other 10
- https://github.com/composer/composer/security/advisories/GHSA-47f6-5gq3-vx9c
- https://github.com/composer/composer/commit/b93fc6ca437da35ae73d667d0618749c763b67d4
- https://github.com/composer/composer/commit/ee28354ca8d33c15949ad7de2ce6656ba3f68704
- https://lists.fedoraproject.org/archives/list/[email protected]/message/VLPJHM2WWSYU2F6KHW2BYFGYL4IGTKHC/
- https://lists.fedoraproject.org/archives/list/[email protected]/message/PO4MU2BC7VR6LMHEX4X7DKGHVFXZV2MC/
- https://github.com/composer/composer
- https://lists.fedoraproject.org/archives/list/[email protected]/message/PO4MU2BC7VR6LMHEX4X7DKGHVFXZV2MC
- https://lists.fedoraproject.org/archives/list/[email protected]/message/VLPJHM2WWSYU2F6KHW2BYFGYL4IGTKHC
- https://www.vicarius.io/vsociety/posts/cve-2024-35241-detect-composer-vulnerability
- https://www.vicarius.io/vsociety/posts/cve-2024-35241-mitigate-vulnerable-composer
More composer vulnerabilities
- TI-2015-06892 Composer before 2016-02-10 allows cache poisoning from other projects built on the same… CVSS 3.1HIGH 8.8
- TI-2021-17955 Command injection in composer on Windows CVSS 3.1CRITICAL 9.8
- TI-2024-23311 Composer vulnerable to command injection via malicious git/hg branch names CVSS 3.1HIGH 8.8
- TI-2021-10185 Code injection in composer CVSS 3.1HIGH 8.8
- TI-2022-08641 Missing input validation can lead to command execution in composer CVSS 3.1HIGH 8.8
- TI-2026-29055 Composer has Command Injection via Malicious Perforce Reference CVSS 3.1HIGH 8.8
Sources
- CVE-2024-35241 · CVE Program
- CVE-2024-35241 · NVD
- FIRST EPSS
- GHSA-47f6-5gq3-vx9c · GitHub Advisory Database · CC BY 4.0
- CVE-2024-35241 · Red Hat security data · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences