CVE-2024-35241
📋 TL;DR
This vulnerability in Composer (PHP dependency manager) allows remote code execution when using certain commands with packages installed from git repositories containing malicious branch names. It affects Composer 2.x versions before 2.2.24 and 2.7.7, potentially impacting any PHP project using Composer with git-based dependencies.
💻 Affected Systems
- Composer
⚠️ Manual Verification Required
This CVE does not have specific version information in our database, so automatic vulnerability detection cannot determine if your system is affected.
Why? The CVE database entry doesn't specify which versions are vulnerable (no version ranges provided by the vendor/NVD).
🔒 Custom verification scripts are available for registered users. Sign up free to download automated test scripts.
- Review the CVE details at NVD
- Check vendor security advisories for your specific version
- Test if the vulnerability is exploitable in your environment
- Consider updating to the latest version as a precaution
⚠️ Risk & Real-World Impact
Worst Case
Full system compromise allowing attacker to execute arbitrary code with the privileges of the Composer process, potentially leading to data theft, ransomware deployment, or complete system takeover.
Likely Case
Attacker gains code execution in the context of the Composer process, enabling them to modify project dependencies, steal credentials, or pivot to other systems.
If Mitigated
With proper controls, impact is limited to the specific Composer process context and isolated from critical systems.
🎯 Exploit Status
Exploitation requires the victim to run Composer commands on a malicious git repository with specially crafted branch names.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 2.2.24 (for 2.2 LTS) or 2.7.7 (for mainline)
Vendor Advisory: https://github.com/composer/composer/security/advisories/GHSA-47f6-5gq3-vx9c
Restart Required: No
Instructions:
1. Update Composer using: composer self-update --2.2.24 (for LTS) or composer self-update --2.7.7 (for mainline). 2. Verify update with: composer --version.
🔧 Temporary Workarounds
Avoid git installations
allConfigure Composer to prefer distribution packages instead of source installations from git
composer install --prefer-dist
Configure preferred install globally
allSet Composer configuration to always prefer dist packages
composer config -g preferred-install dist
🧯 If You Can't Patch
- Avoid running composer status, reinstall, or remove commands on packages installed from git
- Audit all git-based dependencies and ensure they come from trusted sources only
🔍 How to Verify
Check if Vulnerable:
Run: composer --version and check if version is below 2.2.24 (for 2.2 LTS) or below 2.7.7 (for mainline)
Check Version:
composer --version
Verify Fix Applied:
Run: composer --version and confirm version is 2.2.24 or higher (LTS) or 2.7.7 or higher (mainline)
📡 Detection & Monitoring
Log Indicators:
- Unusual Composer process execution patterns
- Composer commands (status, reinstall, remove) being run on git-based packages
- Unexpected child processes spawned from Composer
Network Indicators:
- Composer downloading packages from unexpected git repositories
- Unusual outbound connections from Composer processes
SIEM Query:
process.name:"composer" AND (process.args:"status" OR process.args:"reinstall" OR process.args:"remove")
🔗 References
- https://github.com/composer/composer/commit/b93fc6ca437da35ae73d667d0618749c763b67d4
- https://github.com/composer/composer/commit/ee28354ca8d33c15949ad7de2ce6656ba3f68704
- https://github.com/composer/composer/security/advisories/GHSA-47f6-5gq3-vx9c
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/PO4MU2BC7VR6LMHEX4X7DKGHVFXZV2MC/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/VLPJHM2WWSYU2F6KHW2BYFGYL4IGTKHC/
- https://github.com/composer/composer/commit/b93fc6ca437da35ae73d667d0618749c763b67d4
- https://github.com/composer/composer/commit/ee28354ca8d33c15949ad7de2ce6656ba3f68704
- https://github.com/composer/composer/security/advisories/GHSA-47f6-5gq3-vx9c
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/PO4MU2BC7VR6LMHEX4X7DKGHVFXZV2MC/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/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