Composer has a command injection via malicious git branch name
Published 10 Jun 2024 · Updated 10 Sept 2026
Is your project on an affected composer/composer?
Look after several Laravel or PHP apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie
Affected packages
- Affected
- >=2.0 <2.2.24
- Fixed in
- 2.2.24
composer require composer/composer:^2.2.24- Affected
- >=2.3 <2.7.7
- Fixed in
- 2.7.7
composer require composer/composer:^2.7.7Details
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.
Is GHSA-47f6-5gq3-vx9c in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected composer/composer, and gives you the command that fixes it.
More advisories for composer/composer
- MediumCVE-2026-59944Composer: GHSA-gjfg-22fp-rrxx fix bypass via symlinked package bin path · 2 Oct 2026
- HighCVE-2026-84361Composer arbitrary command execution via a malicious package's Perforce source URL · 8 Sept 2026
- MediumCVE-2026-59946Composer: Path traversal in package bin field lets dependencies chmod arbitrary host files · 20 Jul 2026
- MediumCVE-2026-59947Composer: URL-embedded HTTP-Basic username leaks to verbose logs (GitHub PAT exposure) · 20 Jul 2026
- HighCVE-2026-59948Composer: Arbitrary file write outside vendor via malicious transitive package name · 20 Jul 2026
- HighCVE-2026-45793Github Actions issued GITHUB_TOKEN disclosure in GitHub Actions logs · 19 May 2026
References
- Linkgithub.com/composer/composer/security/advisories/GHSA-47f6-5gq3-vx9c
- Advisorynvd.nist.gov/vuln/detail/CVE-2024-35241
- Linkgithub.com/composer/composer/commit/b93fc6ca437da35ae73d667d0618749c763b67d4
- Linkgithub.com/composer/composer/commit/ee28354ca8d33c15949ad7de2ce6656ba3f68704
- Packagegithub.com/composer/composer
- Linklists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/PO4MU2BC7VR6LMHEX4X7DKGHVFXZV2MC
- Linklists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/VLPJHM2WWSYU2F6KHW2BYFGYL4IGTKHC
- Linkwww.vicarius.io/vsociety/posts/cve-2024-35241-detect-composer-vulnerability
- Linkwww.vicarius.io/vsociety/posts/cve-2024-35241-mitigate-vulnerable-composer
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.