Critical Arbitrary Code Execution Vulnerability in Composer Package

composer Updated 02 Oct 2025

Summary

09/02/2024
N/A
Yes i
High
7.8

CVE-2024-24821: Composer is a dependency Manager for the PHP language. Affects composer across 2 version ranges.

< 2.0.9-2+deb11u2 < 64e4eb356b159a30c766cd1ea83450a38dc23bf5

Fixed in 2.0.9-2+deb11u2. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

Composer is a widely used dependency manager for the PHP programming language, enabling developers to manage libraries and packages efficiently. It simplifies the process of integrating third-party libraries into PHP projects, ensuring that the correct versions are installed and maintained. However, Composer has been found to have a critical vulnerability that can lead to arbitrary code execution under certain conditions, particularly when run in untrusted directories or with elevated privileges.

Vulnerability Detail

The vulnerability (CVE-2024-24821) arises from Composer's inclusion of files within the local working directory during its execution. This behavior can be exploited to execute arbitrary code, potentially leading to local privilege escalation, lateral user movement, or execution of malicious code. The risk is heightened in scenarios where Composer is run with sudo privileges, in shared environments, or in CI/CD pipelines that execute Composer on untrusted projects. The vulnerability affects all Composer CLI commands, including self-update operations.

How To Fix

Minimum fixed version

2.0.9-2+deb11u2

This is the first release that contains the fix.

sudo apt-get install --only-upgrade composer

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If immediate updating is not feasible, consider the following workarounds: 1. Remove all sudo composer privileges for all users to mitigate root privilege escalation. 2. Avoid running Composer within untrusted directories. 3. If necessary, verify that the contents of 'vendor/composer/InstalledVersions.php' and 'vendor/composer/installed.php' do not include untrusted code. You can reset these files using the following commands:

rm vendor/composer/installed.php vendor/composer/InstalledVersions.php
composer install --no-scripts --no-plugins

Conclusion

The CVE-2024-24821 vulnerability in Composer poses significant risks to systems using this dependency manager. It is crucial to update to the latest patched versions or implement the recommended workarounds to mitigate potential threats. Regular monitoring and vulnerability management practices, such as using Vulert, can help maintain the security of your applications.

See every vulnerability recorded for composer →

Share this vulnerability

FAQ

CVE-2024-24821 is a critical vulnerability in Composer that allows for arbitrary code execution when Composer is run in untrusted directories or with elevated privileges.

The risks include local privilege escalation, lateral movement within a system, and the potential execution of malicious code, especially in shared or CI/CD environments.

You can use Vulert, which monitors open-source vulnerabilities in real-time. By uploading your manifest file like package-lock.json, you can check for vulnerabilities without needing to install any software.

If you cannot update Composer, ensure to remove sudo privileges, avoid running Composer in untrusted directories, and verify the integrity of specific Composer files.

The CVSS score of this vulnerability is 7.8, indicating a high level of severity.

Related vulnerabilities

Recent vulnerabilities recorded for composer.

How To Fix

Minimum fixed version

2.0.9-2+deb11u2

This is the first release that contains the fix.

sudo apt-get install --only-upgrade composer

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback