CVE-2024-24821: Composer code execution and possible privilege escalation via compromised InstalledVersions.php or installed.php
Impact Several files within the local working directory are included during the invocation of Composer and in the context of the executing user. As such, under certain conditions arbitrary code execution may lead to local privilege escalation, provide lateral user movement or malicious code execution when Composer is invoked within a directory with tampered files.
Published Feb 8, 2024 · Updated Feb 9, 2024
Affected packages
composer/composer
- Ecosystem
- Composer (PHP)
- Affected
- >= 2.0.0-alpha1, < 2.2.23
- Fixed in
- 2.2.23
- Check
composer show composer/composer
composer/composer
- Ecosystem
- Composer (PHP)
- Affected
- >= 2.3.0-rc1, < 2.7.0
- Fixed in
- 2.7.0
- Check
composer show composer/composer
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Impact
Several files within the local working directory are included during the invocation of Composer and in the context of the executing user.
As such, under certain conditions arbitrary code execution may lead to local privilege escalation, provide lateral user movement or malicious code execution when Composer is invoked within a directory with tampered files.
All Composer CLI commands are affected, including composer.phar's self-update.
The following are of high risk:
- Composer being run with sudo.
- Pipelines which may execute Composer on untrusted projects.
- Shared environments with developers who run Composer individually on the same project.
Patches
2.7.0, 2.2.23
Workarounds
- It is advised that the patched versions are applied at the earliest convenience.
Where not possible, the following should be addressed:
- Remove all sudo composer privileges for all users to mitigate root privilege escalation.
- Avoid running Composer within an untrusted directory, or if needed, verify that the contents of
vendor/composer/InstalledVersions.phpandvendor/composer/installed.phpdo not include untrusted code.
A reset can also be done on these files by the following:
rm vendor/composer/installed.php vendor/composer/InstalledVersions.php
composer install --no-scripts --no-pluginsCredited to edonsec.
References
- https://github.com/composer/composer/security/advisories/GHSA-7c6p-848j-wh5h
- https://github.com/composer/composer/commit/64e4eb356b159a30c766cd1ea83450a38dc23bf5
- https://github.com/composer/composer/commit/77e3982918bc1d886843dc3d5e575e7e871b27b7
- https://nvd.nist.gov/vuln/detail/CVE-2024-24821
- https://github.com/advisories/GHSA-7c6p-848j-wh5h
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
