CVE-2024-35242: Composer has multiple command injections via malicious git/hg branch names
Impact The composer install command running inside a git/hg repository which has specially crafted branch names can lead to command injection. So this requires cloning untrusted repositories. Patches 2.2.24 for 2.2 LTS or 2.7.7 for mainline Workarounds Avoid cloning potentially compromised repositories.
Published Jun 10, 2024 · Updated Feb 13, 2025
Affected packages
composer/composer
- Ecosystem
- Composer (PHP)
- Affected
- >= 2.0, < 2.2.24
- Fixed in
- 2.2.24
- Check
composer show composer/composer
composer/composer
- Ecosystem
- Composer (PHP)
- Affected
- >= 2.3, < 2.7.7
- Fixed in
- 2.7.7
- Check
composer show composer/composer
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Impact
The composer install command running inside a git/hg repository which has specially crafted branch names can lead to command injection. So this requires cloning untrusted repositories.
Patches
2.2.24 for 2.2 LTS or 2.7.7 for mainline
Workarounds
Avoid cloning potentially compromised repositories.
Credited to haqpl.
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://nvd.nist.gov/vuln/detail/CVE-2024-35242
- https://lists.fedoraproject.org/archives/list/[email protected]/message/VLPJHM2WWSYU2F6KHW2BYFGYL4IGTKHC
- https://lists.fedoraproject.org/archives/list/[email protected]/message/PO4MU2BC7VR6LMHEX4X7DKGHVFXZV2MC
- https://github.com/advisories/GHSA-v9qv-c7wm-wgmf
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More Composer (PHP) vulnerabilities
All Composer (PHP) entriesCVE-2026-59944
Composer: GHSA-gjfg-22fp-rrxx fix bypass via symlinked package bin path
medium6.1Oct 2, 2026CVE-2026-84361
Composer arbitrary command execution via a malicious package's Perforce source URL
high7.7Sep 8, 2026CVE-2026-59946
Composer: Path traversal in package bin field lets dependencies chmod arbitrary host files
medium6.1Jul 20, 2026CVE-2026-59947
Composer: URL-embedded HTTP-Basic username leaks to verbose logs (GitHub PAT exposure)
medium4.7Jul 20, 2026CVE-2026-59948
Composer: Arbitrary file write outside vendor via malicious transitive package name
high7.0Jul 20, 2026CVE-2026-45793
Github Actions issued GITHUB_TOKEN disclosure in GitHub Actions logs
high7.5May 19, 2026
