Skip to content
Fencer Vulns
high 8.8

CVE-2024-35242 json

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

published 2024-06-10 2 y ago modified 2026-09-10 1 mo ago also BIT-composer-2024-35242 , EUVD-2024-2177 , GHSA-v9qv-c7wm-wgmf

cvss
8.8
version 3.1, CNA
cisa kev
Not listed
not in CISA's catalog
epss
3.3%
EPSS 3.3% chance of exploitation in 30 days, percentile 88%
public exploits
0
none known

Summary

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.

Patch / fix

  • packagist composer/composer 2.2.24, 2.7.7
  • bitnami composer 2.2.24, 2.7.7
  • getcomposer composer 2.2.24, 2.7.7
  • composer Debian 12 2.5.5-1+deb12u2
  • composer Debian 14, Debian 13 2.7.7-1

debian advisories DEBIAN-CVE-2024-35242

  • composer Ubuntu Pro 16.04 LTS 1.0.0~beta2-1ubuntu0.1~esm2
  • composer Ubuntu Pro 18.04 LTS 1.6.3-1ubuntu0.1~esm2
  • composer Ubuntu Pro 20.04 LTS 1.10.1-1ubuntu0.1~esm2
  • composer Ubuntu Pro 22.04 LTS 2.2.6-2ubuntu4+esm1
  • composer Ubuntu Pro 24.04 LTS 2.7.1-2ubuntu0.1~esm1

ubuntu advisories UBUNTU-CVE-2024-35242

Ubuntu security data © Canonical Ltd., from https://github.com/canonical/ubuntu-security-notices via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0

  • php-composer2 SLES for SAP 15 SP6, SLES 15 SP6-LTSS, SLE Module for Web and Scripting 15 SP7 2.6.4-150600.3.12.1
  • php-composer2 SLE Module for Web and Scripting 15 SP6, openSUSE Leap 15.6 2.6.4-150600.3.3.1
  • php-composer2 SLES for SAP 15 SP4, SLES 15 SP4-LTSS, SLE Module for Web and Scripting 15 SP5 +4 more 2.2.3-150400.3.12.1

suse advisories SUSE-SU-2026:3105-1SUSE-SU-2024:2107-1SUSE-SU-2024:2106-1

  • php-composer2 openSUSE Tumbleweed 2.7.7-1.1

opensuse advisories openSUSE-SU-2024:14040-1

  • composer Alpine 3.24, Alpine 3.23, Alpine 3.22 +3 more 2.7.7-r0

alpine advisories ALPINE-CVE-2024-35242

Alpine secdb © Alpine Linux, from https://secdb.alpinelinux.org via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0

Vendor advisories

What the vendors themselves say about their products: affected, fixed or not affected, and what to do.

red hat product security vex CVE-2024-35242 updated cvss 8.8

composer: crafted branch names can lead to command injection

  • Red Hat All currently supported Red Hat products
    not affected: vulnerable code not present

Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf

CISA SSVC

Exploitation
none
Automatable
no
Technical impact
total
Assessed
2 y ago

Exploit prediction

3.28% chance of exploitation in the next 30 days, higher than 88% of all scored CVEs (FIRST EPSS, 2026-11-08).

CVSS scores

assigned by version score vector
CNA 3.1 8.8 CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
GitHub 3.1 8.8 CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
OSV 3.1 8.8 CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

Affected packages

ecosystem package affected fixed in
packagist composer/composer
>=2.0, <2.2.24
>=2.3, <2.7.7
2.2.24
2.7.7
bitnami composer
>=2.0.0, <2.2.24
>=2.3.0, <2.7.7
2.2.24
2.7.7

Affected products

  • composer composer
  • fedoraproject fedora
  • getcomposer composer

Classification

Weakness
  • CWE-77 Improper Neutralization of Special Elements used in a Command

References

Sources

Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.

CPEs and fixed versions use Anchore's correction of NVD's data: Added CPE configurations because not yet analyzed by NVD.