CVE-2024-24821Code execution and possible privilege escalation via compromised InstalledVersions.php…
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 ```
What to do
Fixed builds are available from Alpine, Debian, Packagist: see the table below for the fixed version per release.
Ubuntu has not shipped a fix for every release yet.
Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.
curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \ -H "Content-Type: text/plain" --data-binary @inventory.txt
Vendor status at a glance
Status by vendor and release
From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 26.04 | composer | Not affected vulnerable_code_not_present | ||
| Ubuntu 25.10 | composer | Not affected vulnerable_code_not_present | ||
| Ubuntu 22.04 | composer | Fix pending | 2.2.6-2ubuntu4+esm1 (Ubuntu Pro) | UBUNTU-CVE-2024-24821 |
| Ubuntu 16.04 | composer | Fix pending | ||
| Debian 14 | composer | Fixed | 2.7.1-1 | DEBIAN-CVE-2024-24821 |
| Debian 13 | composer | Fixed | 2.7.1-1 | DEBIAN-CVE-2024-24821 |
| Debian 12 | composer | Fixed | 2.5.5-1+deb12u1 | DEBIAN-CVE-2024-24821 |
| Alpine Linux 3.24 | composer | Fixed | 2.7.0-r0 | ALPINE-CVE-2024-24821 |
| Alpine Linux 3.23 | composer | Fixed | 2.7.0-r0 | ALPINE-CVE-2024-24821 |
| Alpine Linux 3.22 | composer | Fixed | 2.7.0-r0 | ALPINE-CVE-2024-24821 |
| Alpine Linux 3.21 | composer | Fixed | 2.7.0-r0 | ALPINE-CVE-2024-24821 |
| Alpine Linux 3.20 | composer | Fixed | 2.7.0-r0 | ALPINE-CVE-2024-24821 |
| Alpine Linux 3.19 | composer | Fixed | 2.7.0-r0 | ALPINE-CVE-2024-24821 |
| Packagist library | composer/composer | Fixed | 2.2.23 | GHSA-7c6p-848j-wh5h |
What the vendor says
As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.
- composer: affected: >= 2.0, < 2.2.23, >= 2.3, < 2.7
References
- https://github.com/composer/composer/security/advisories/GHSA-7c6p-848j-wh5h
- https://github.com/composer/composer/commit/64e4eb356b159a30c766cd1ea83450a38dc23bf5
About this page
Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.