CVEfocus › CVE database › CVE-2024-24821

CVE-2024-24821Code execution and possible privilege escalation via compromised InstalledVersions.php…

CVSS 8.8 HighEPSS 0.3% (higher than 17% of CVEs)Published 2024-02-08Updated 2025-06-17Assigner: GitHub_M

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

CWE-829

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

10Fixed
2Fix pending
2Not affected

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.

ReleasePackageStatusFixed versionAdvisory
Ubuntu 26.04composerNot affected
vulnerable_code_not_present
Ubuntu 25.10composerNot affected
vulnerable_code_not_present
Ubuntu 22.04composerFix pending2.2.6-2ubuntu4+esm1 (Ubuntu Pro)UBUNTU-CVE-2024-24821
Ubuntu 16.04composerFix pending
Debian 14composerFixed2.7.1-1DEBIAN-CVE-2024-24821
Debian 13composerFixed2.7.1-1DEBIAN-CVE-2024-24821
Debian 12composerFixed2.5.5-1+deb12u1DEBIAN-CVE-2024-24821
Alpine Linux 3.24composerFixed2.7.0-r0ALPINE-CVE-2024-24821
Alpine Linux 3.23composerFixed2.7.0-r0ALPINE-CVE-2024-24821
Alpine Linux 3.22composerFixed2.7.0-r0ALPINE-CVE-2024-24821
Alpine Linux 3.21composerFixed2.7.0-r0ALPINE-CVE-2024-24821
Alpine Linux 3.20composerFixed2.7.0-r0ALPINE-CVE-2024-24821
Alpine Linux 3.19composerFixed2.7.0-r0ALPINE-CVE-2024-24821
Packagist librarycomposer/composerFixed2.2.23GHSA-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.

References

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.