Summary
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-plugins
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.
CVE-2024-24821 has a CVSS score of 8.8 (High). The vector is requires local access, low privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (2.2.23, 2.7.0); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Remediation advice
2.7.0, 2.2.23
Frequently Asked Questions
- What is CVE-2024-24821? CVE-2024-24821 is a high-severity security vulnerability in composer/composer (composer), affecting versions >= 2.0.0-alpha1, < 2.2.23. It is fixed in 2.2.23, 2.7.0.
- How severe is CVE-2024-24821? CVE-2024-24821 has a CVSS score of 8.8 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of composer/composer are affected by CVE-2024-24821? composer/composer (composer) versions >= 2.0.0-alpha1, < 2.2.23 is affected.
- Is there a fix for CVE-2024-24821? Yes. CVE-2024-24821 is fixed in 2.2.23, 2.7.0. Upgrade to this version or later.
- Is CVE-2024-24821 exploitable, and should I be worried? Whether CVE-2024-24821 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2024-24821 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2024-24821?
- Upgrade
composer/composerto 2.2.23 or later - Upgrade
composer/composerto 2.7.0 or later
- Upgrade