CVE-2024-35242
JSON

8.8high

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

Severity
8.8high CVSS:3.1 by GitHub_M
Exploit likelihood
3.28% (higher than 88% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-v9qv-c7wm-wgmfBIT-COMPOSER-2024-35242

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

Product or packageVersionsReported by
composer composer>= 2.0, < 2.2.24, >= 2.3, < 2.7.7CVE List
fedoraproject fedora39, 40CVE List
getcomposer composerfrom 2.0 before 2.2.24, from 2.3 before 2.7.7CVE List
composer/composer (Packagist)from 2.0 before 2.2.24, from 2.3 before 2.7.7GitHub Advisory Database
composer (Bitnami)from 2.0.0 before 2.2.24, from 2.3.0 before 2.7.7Bitnami Vulnerability Database

All scores

GitHub_M8.8high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
GitHub8.8high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Bitnami Vulnerability Databasehigh rating

Classification

CWE-77

SSVC (CISA-ADP): exploitation none, automatable no, technical impact total.

What each source says

CVE List

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.

GitHub Advisory Database
Impact

The composer install command running inside a git/hg repository which has specially crafted branch names can lead to command injection. So this requires cloning untrusted repositories.

Patches

2.2.24 for 2.2 LTS or 2.7.7 for mainline

Workarounds

Avoid cloning potentially compromised repositories.

NVD (es)

Composer es un administrador de dependencias para PHP. En la rama 2.x anterior a las versiones 2.2.24 y 2.7.7, el comando `composer install` que se ejecuta dentro de un repositorio git/hg que tiene nombres de rama especialmente manipulados puede provocar la inyección de comandos. Esto requiere clonar repositorios que no sean de confianza. Los parches están disponibles en la versión 2.2.24 para 2.2 LTS o 2.7.7 para la línea principal. Como workaround, evite clonar repositorios potencialmente comprometidos.

References

https://github.com/composer/composer/security/advisories/GHSA-v9qv-c7wm-wgmfweb
https://github.com/composer/composer/commit/6bd43dff859c597c09bd03a7e7d6443822d0a396web
https://github.com/composer/composer/commit/fc57b93603d7d90b71ca8ec77b1c8a9171fdb467web
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/VLPJHM2WWSYU2F6KHW2BYFGYL4IGTKHC/web
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/PO4MU2BC7VR6LMHEX4X7DKGHVFXZV2MC/web
https://nvd.nist.gov/vuln/detail/CVE-2024-35242advisory, web
https://github.com/composer/composerpackage
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/PO4MU2BC7VR6LMHEX4X7DKGHVFXZV2MCweb
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/VLPJHM2WWSYU2F6KHW2BYFGYL4IGTKHCweb

Sources

SourceRecordLicence
CVE ListCVE-2024-35242 changed 2025-02-13CVE Terms of Use
GitHub Advisory DatabaseGHSA-v9qv-c7wm-wgmf changed 2026-09-10CC-BY-4.0
NVDCVE-2024-35242 changed 2026-06-17Public domain
Bitnami Vulnerability DatabaseBIT-COMPOSER-2024-35242 changed 2025-05-20Apache-2.0