CVE-2024-35242
High · 8.8CVSS
8.8
EPSS
3.3%
Published
Jun 10, 2024
CISA due date
—
Cloudanix analysis
A dependency tool can be tricked into running attacker commands if developers install packages from a specially prepared code repository.
- Exploitation
- Requires User Interaction
- Attacker needs
- User Interaction
- Complexity
- Low
- Impact
- Remote Code Execution
- Component
- Application
- Class
- Command Injection
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Command injection via specially crafted git/hg branch names during composer install when the working directory is an untrusted repository clone.
Why it matters to the business
Attackers can execute arbitrary commands on developer or CI systems that process untrusted PHP dependency repositories, potentially leading to code theft, supply-chain tampering, or full workstation compromise.
How an attack unfolds
An attacker publishes or tricks a victim into cloning a malicious git repository containing branch names that embed shell commands. When the victim runs composer install inside that repository, the unsanitized branch name is passed to a shell, executing attacker-controlled commands.
How to fix it
Upgrade composer/composer to version 2.2.24 (2.2 LTS) or 2.7.7. Workaround: avoid running composer install inside clones of untrusted repositories.
How to confirm the fix worked
Confirm the installed composer version is at least 2.2.24 or 2.7.7; test that branch names containing shell metacharacters no longer result in command execution.
Typical attack path
- Create a git repository with branch names containing command-injection payloads
- Trick a target into cloning the repository and running composer install inside it
- Composer parses the malicious branch name and passes it to an underlying shell command
- Arbitrary OS commands execute with the privileges of the composer process
How to detect it
Review shell history, CI logs, and process execution logs for composer invocations that coincide with unusual branch names or unexpected child processes spawned during install operations.
What your security team should do
- Immediately upgrade all Composer installations to 2.2.24 or 2.7.7
- Add repository-origin checks or sandboxing for composer install steps in CI/CD pipelines
- Scan existing codebases and logs for any prior execution of composer inside untrusted clones
The record
Composer is a dependency manager for PHP. On the 2.x branch prior to versions 2.2.24 and 2.7.7, the `composer install` command running inside a git/hg repository which has specially crafted branch names can lead to command injection. This requires cloning untrusted repositories. Patches are available in version 2.2.24 for 2.2 LTS or 2.7.7 for mainline. As a workaround, avoid cloning potentially compromised repositories.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Packagist | composer/composer | 2.0 | 2.2.24 |
| Packagist | composer/composer | 2.3 | 2.7.7 |
| Bitnami | composer | 2.0.0 | 2.2.24 |
| Chainguard | composer | 0 | 2.7.7-r0 |
| Debian:10 | composer | 0 | 1.8.4-1+deb10u4 |
| Debian:11 | composer | 0 | 2.0.9-2+deb11u3 |
| Debian:12 | composer | 0 | 2.5.5-1+deb12u2 |
| Debian:13 | composer | 0 | 2.7.7-1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP4-ESPOS | php-composer2 | 0 | 2.2.3-150400.3.12.1 |
| SUSE:Linux Enterprise High Performance Computing 15 SP4-LTSS | php-composer2 | 0 | 2.2.3-150400.3.12.1 |
| SUSE:Linux Enterprise Module for Web and Scripting 15 SP5 | php-composer2 | 0 | 2.2.3-150400.3.12.1 |
| SUSE:Linux Enterprise Module for Web and Scripting 15 SP6 | php-composer2 | 0 | 2.6.4-150600.3.3.1 |
| SUSE:Linux Enterprise Server 15 SP4-LTSS | php-composer2 | 0 | 2.2.3-150400.3.12.1 |
| SUSE:Linux Enterprise Server for SAP Applications 15 SP4 | php-composer2 | 0 | 2.2.3-150400.3.12.1 |
| SUSE:Manager Server 4.3 | php-composer2 | 0 | 2.2.3-150400.3.12.1 |
| Ubuntu:20.04:LTS | composer | 0 | No fix |
| Ubuntu:22.04:LTS | composer | 0 | No fix |
| Ubuntu:24.04:LTS | composer | 0 | No fix |
| Ubuntu:24.10 | composer | 0 | 2.7.7-2 |
| Ubuntu:Pro:16.04:LTS | composer | 0 | No fix |
| Ubuntu:Pro:16.04:LTS | composer | 0 | 1.0.0~beta2-1ubuntu0.1~esm2 |
| Ubuntu:Pro:18.04:LTS | composer | 0 | No fix |
| Ubuntu:Pro:18.04:LTS | composer | 0 | 1.6.3-1ubuntu0.1~esm2 |
| Ubuntu:Pro:20.04:LTS | composer | 0 | 1.10.1-1ubuntu0.1~esm2 |
| Ubuntu:Pro:22.04:LTS | composer | 0 | 2.2.6-2ubuntu4+esm1 |
| Ubuntu:Pro:24.04:LTS | composer | 0 | 2.7.1-2ubuntu0.1~esm1 |
| Wolfi | composer | 0 | 2.7.7-r0 |
| openSUSE:Leap 15.5 | php-composer2 | 0 | 2.2.3-150400.3.12.1 |
| openSUSE:Leap 15.6 | php-composer2 | 0 | 2.6.4-150600.3.3.1 |
| openSUSE:Tumbleweed | php-composer2 | 0 | 2.7.7-1.1 |
| packagist | composer/composer | 2.0 | 2.2.24 |
| packagist | composer/composer | 2.3 | 2.7.7 |
Related vulnerabilities
- GHSA-59pp-r3rg-353g Composer is vulnerable to ANSI sequence injection Also affects composer/composer
- CVE-2025-67746 Composer is a dependency manager for PHP. Also affects composer/composer
- CVE-2024-35241 Composer is a dependency manager for PHP. Also affects composer/composer
- CVE-2026-40176 Composer is a dependency manager for PHP. Also affects php-composer2
- CVE-2026-40261 Composer is a dependency manager for PHP. Also affects php-composer2
- CVE-2026-114575 A flaw has been found in TOTOLINK A950RG 4.1.2cu.5268_B20221104. CWE-77
- CVE-2026-112942 launch-editor allows users to open files with line numbers in editor from Node.js. CWE-77
- CVE-2026-55453 OpenPrinting CUPS is an open source printing system for Linux and other Unix-like… CWE-77