# CVE-2024-24821: Code execution and possible privilege escalation via compromised InstalledVersions.php or installed.php in Composer

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 8.8
- **CVSS:** 8.8 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H`
- **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
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.32% (percentile 17, 2026-11-28)
- **CWE:** CWE-829
- **Aliases:** BIT-composer-2024-24821, GHSA-7c6p-848j-wh5h
- **Published:** 2024-02-08T15:06:38.000Z
- **Modified:** 2026-09-10T03:50:09.776Z

## 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

## 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

- Packagist `composer/composer`: affected \>= 2.0.0-alpha1, \< 2.2.23; fixed 2.2.23, 2.7.0 (osv)
- composer: \>= 2.0, \< 2.2.23; \>= 2.3, \< 2.7 (cvelist)

## Mitigation

- Upgrade composer/composer to one of 2.2.23, 2.7.0 (or later in the same release line).

## Check your systems with an agent

Paste this into a coding agent:

```text
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.
```

## 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-28).

### 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.

## References

- vendor: <https://github.com/composer/composer/security/advisories/GHSA-7c6p-848j-wh5h>
- vendor: <https://nvd.nist.gov/vuln/detail/CVE-2024-24821>
- patch: <https://github.com/composer/composer/commit/64e4eb356b159a30c766cd1ea83450a38dc23bf5>
- patch: <https://github.com/composer/composer/commit/77e3982918bc1d886843dc3d5e575e7e871b27b7>
- other: <https://github.com/composer/composer>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2024-24821>
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/GHSA-7c6p-848j-wh5h> (license: <https://creativecommons.org/licenses/by/4.0/>)

HTML: <https://flawdb.com/CVE-2024-24821> · JSON: <https://flawdb.com/api/v1/entries/CVE-2024-24821>
