Skip to content
OpenAdvisories
High · 8.8 Public exploit CVE-2024-35242 BIT-composer-2024-35242EUVD-2024-2177GHSA-v9qv-c7wm-wgmf

Composer vulnerable to command injection via malicious git/hg branch names

Published Jun 10, 2024 · Updated Feb 13, 2025 · Assigned by GitHub_M

Description

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 products

VendorProductAffectedFixed
composer composer >= 2.0, < 2.2.24, >= 2.3, < 2.7.7 —

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 composer 2.7.7-1 —
Debian 13 composer 2.7.7-1 —
Debian 12 composer 2.5.5-1+deb12u2 DSA-5715-1
Debian 11 composer 2.0.9-2+deb11u3 DSA-5715-1
Debian 10 composer 1.8.4-1+deb10u4 DLA-3838-1
ReleasePackageFixed inAdvisory
Ubuntu Pro 24.04 LTS composer 2.7.1-2ubuntu0.1~esm1 USN-7603-1
Ubuntu Pro 22.04 LTS composer 2.2.6-2ubuntu4+esm1 USN-7603-1
Ubuntu Pro 20.04 LTS composer 1.10.1-1ubuntu0.1~esm2 USN-7603-1
Show 2 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Ubuntu Pro 18.04 LTS composer 1.6.3-1ubuntu0.1~esm2 USN-7603-1
Ubuntu Pro 16.04 LTS composer 1.0.0~beta2-1ubuntu0.1~esm2 USN-7603-1
ReleasePackageFixed inAdvisory
SLES 15 SP7 php-composer2 2.6.4-150600.3.12.1 SUSE-SU-2026:3105-1
SLES 15 SP6 php-composer2 2.6.4-150600.3.3.1 SUSE-SU-2026:3105-1, SUSE-SU-2024:2107-1
SLES 15 SP5 php-composer2 2.2.3-150400.3.12.1 SUSE-SU-2024:2106-1
SLES 15 SP4 php-composer2 2.2.3-150400.3.12.1 SUSE-SU-2024:2106-1
Show 4 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
SLES for SAP 15 SP6 php-composer2 2.6.4-150600.3.12.1 SUSE-SU-2026:3105-1
SLES for SAP 15 SP4 php-composer2 2.2.3-150400.3.12.1 SUSE-SU-2024:2106-1
SLE HPC 15 SP4 php-composer2 2.2.3-150400.3.12.1 SUSE-SU-2024:2106-1
SUSE Manager Server 4.3 php-composer2 2.2.3-150400.3.12.1 SUSE-SU-2024:2106-1
ReleasePackageFixed inAdvisory
openSUSE Tumbleweed php-composer2 2.7.7-1.1 openSUSE-SU-2024:14040-1
openSUSE Leap 15.6 php-composer2 2.6.4-150600.3.3.1 SUSE-SU-2024:2107-1
openSUSE Leap 15.5 php-composer2 2.2.3-150400.3.12.1 SUSE-SU-2024:2106-1
ReleasePackageFixed inAdvisory
Alpine v3.24 composer 2.7.7-r0 —
Alpine v3.23 composer 2.7.7-r0 —
Alpine v3.22 composer 2.7.7-r0 —
Alpine v3.21 composer 2.7.7-r0 —
Alpine v3.20 composer 2.7.7-r0 —
Show 1 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Alpine v3.19 composer 2.7.7-r0 —

Amazon Linux

ReleasePackageFixed inAdvisory
Amazon Linux 2023 composer 2.5.8-2.amzn2023.0.4 ALAS2023-2024-659

Wolfi

ReleasePackageFixed inAdvisory
Wolfi rolling composer 2.7.7-r0 —

Public exploits

Exploit or proof-of-concept code for this vulnerability is publicly available, which lowers the bar for attackers. Treat it as a reason to patch sooner.

Third-party code, not reviewed by us. Public PoCs are sometimes fake or contain malware. Read the code first and run it only in an isolated lab, against systems you are authorised to test.

GitHub 1 repository

Sources: PoC-in-GitHub, Metasploit Framework, Exploit-DB — updated daily. Only links are listed; no exploit code is hosted here.

Affected packages

EcosystemPackageAffectedFixedRecord
Packagist composer/composer >= 2.0, < 2.2.24 2.2.24 GHSA-v9qv-c7wm-wgmf
Packagist composer/composer >= 2.3, < 2.7.7 2.7.7 GHSA-v9qv-c7wm-wgmf

Advisories 8

References