CVE-2024-35241: Composer has a command injection via malicious git branch name
Impact 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 2.2.24 for 2.2 LTS or 2.7.7 for mainline Workarounds Avoid installing dependencies via git by using --prefer-dist or the preferred-install: dist config setting.
Published Jun 10, 2024 · Updated Apr 23, 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 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
2.2.24 for 2.2 LTS or 2.7.7 for mainline
Workarounds
Avoid installing dependencies via git by using --prefer-dist or the preferred-install: dist config setting.
Credited to martinhaunschmid.
References
- 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://nvd.nist.gov/vuln/detail/CVE-2024-35241
- https://lists.fedoraproject.org/archives/list/[email protected]/message/VLPJHM2WWSYU2F6KHW2BYFGYL4IGTKHC
- https://lists.fedoraproject.org/archives/list/[email protected]/message/PO4MU2BC7VR6LMHEX4X7DKGHVFXZV2MC
- https://www.vicarius.io/vsociety/posts/cve-2024-35241-detect-composer-vulnerability
- https://www.vicarius.io/vsociety/posts/cve-2024-35241-mitigate-vulnerable-composer
- https://github.com/advisories/GHSA-47f6-5gq3-vx9c
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
