CVE-2024-24821
Code execution and possible privilege escalation via compromised InstalledVersions.php or installed.php in Composer
Also known as BIT-composer-2024-24821, GHSA-7c6p-848j-wh5h
Mitigation
- Upgrade composer/composer to one of 2.2.23, 2.7.0 (or later in the same release line).
Who should check
- Projects that depend on Packagist package composer/composer (>= 2.0.0-alpha1, < 2.2.23)
- Anyone running composer >= 2.0, < 2.2.23; >= 2.3, < 2.7
Vulnerability facts
- Affected
- composer/composer >= 2.0.0-alpha1, < 2.2.23
- Fixed in
- 2.2.23, 2.7.0
- Exploited in the wild
- Not in CISA KEV
- Public exploit / PoC
- None known
- Remote exploitation
- Not remotely exploitable (local or adjacent access needed)
- CVSS
- 8.8 (v3.1, CNA)CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:HOpen in CVSS calculator
Show all 8 CVSS metrics
- Attack vector: Local
- Attack complexity: Low
- Privileges required: Low
- User interaction: None
- Scope: Changed (impact reaches other components)
- Confidentiality impact: High
- Integrity impact: High
- Availability impact: High
- EPSS
- 0.32% chance of exploitation in 30 days (percentile 17, 2026-11-26)
- CWE
- CWE-829
- Modified
Description
Composer is a dependency Manager for the PHP language. In affected versions 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 scenarios 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. This vulnerability has been addressed in versions 2.7.0 and 2.2.23. 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, and avoid running Composer within an untrusted directory, or if needed, verify that the contents of `vendor/composer/InstalledVersions.php` and `vendor/composer/installed.php` do not include untrusted code. A reset can also be done on these files by the following:```sh rm vendor/composer/installed.php vendor/composer/InstalledVersions.php composer install --no-scripts --no-plugins ```
Affected and fixed versions
| Package / product | Affected | Fixed | Source |
|---|---|---|---|
| Packagist composer/composer | >= 2.0.0-alpha1, < 2.2.23 | 2.2.23, 2.7.0 | osv |
| composer | >= 2.0, < 2.2.23; >= 2.3, < 2.7 | — | cvelist |
Check your systems with an agent
Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.
Check whether anything I run is affected by CVE-2024-24821. Work read-only: do not install, upgrade, delete or change anything. Details: https://flawdb.com/CVE-2024-24821.md Affected: composer/composer >= 2.0.0-alpha1, < 2.2.23 Fixed in: 2.2.23, 2.7.0 Steps: 1. Search this machine and project for composer/composer (Packagist), composer: dependency manifests and lockfiles, installed packages, container images and running services. 2. For each match, note the installed version and whether it is inside the affected range. 3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
References
Vendor advisories
Patches
FAQ
Is CVE-2024-24821 being exploited?
There is no confirmed exploitation: CVE-2024-24821 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.32% chance of exploitation in the next 30 days (as of 2026-11-26).
How serious is CVE-2024-24821?
High: CVSS 8.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).
Which versions are affected by CVE-2024-24821?
composer/composer >= 2.0.0-alpha1, < 2.2.23.
Is there a fix for CVE-2024-24821?
Yes. Fixed in 2.2.23, 2.7.0. Upgrade composer/composer to one of 2.2.23, 2.7.0 (or later in the same release line).
How do I check if I'm affected by CVE-2024-24821?
Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.