Composer vulnerable to command injection via malicious git/hg branch names
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.
- Products
- Not specified
- Affected versions
- Not specified
- Fixed versions
- Not specified
- CVEs
- CVE-2024-35242
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 3 Nov 2026, 17:59 UTC · Revision 1
Source evidence
Composer vulnerable to command injection via malicious git/hg branch names
core-osv · Original sourcePublished 10 Jun 2024, 21:23 UTC
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.
osv:CVE-2024-35242
Complete source record
{
"id": "70b8a3d294e3fd6e3e8e39f11b43e9efbfdedfbdf0627c8190e2fadd007f7b19",
"url": "https://osv.dev/vulnerability/CVE-2024-35242",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "Composer vulnerable to command injection via malicious git/hg branch names",
"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.",
"evidence": "osv:CVE-2024-35242",
"products": [],
"severity": "high",
"structured": {
"id": "CVE-2024-35242",
"aliases": [
"BIT-composer-2024-35242",
"CVE-2024-35242",
"GHSA-v9qv-c7wm-wgmf"
],
"metrics": [
{
"type": "CVSS_V3",
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
}
],
"affected": [
{
"ranges": [
{
"repo": "https://github.com/composer/composer",
"type": "GIT",
"events": [
{
"introduced": "378b34c5e33c71d194f33e1b73a62ba22148ff13"
},
{
"fixed": "91d9d38ebc274267f952ee1fd3892dc7962075f4"
},
{
"introduced": "934ee6eed3c3ffd0aeccef7c1d255adcf0752b24"
},
{
"fixed": "291942978f39435cf904d33739f98d7d4eca7b23"
},
{
"fixed": "6bd43dff859c597c09bd03a7e7d6443822d0a396"
},
{
"fixed": "fc57b93603d7d90b71ca8ec77b1c8a9171fdb467"
}
],
"database_specific": {
"extracted_events": [
{
"range": [
{
"introduced": "2.0"
},
{
"fixed": "2.2.24"
}
],
"source": "AFFECTED_FIELD",
"strategy": "StringRangeExpression"
},
{
"range": [
{
"introduced": "2.3"
},
{
"fixed": "2.7.7"
}
],
"source": "AFFECTED_FIELD",
"strategy": "StringRangeExpression"
},
{
"range": [
{
"fixed": "6bd43dff859c597c09bd03a7e7d6443822d0a396"
}
],
"source": "REFERENCES_COMMIT"
},
{
"range": [
{
"fixed": "fc57b93603d7d90b71ca8ec77b1c8a9171fdb467"
}
],
"source": "REFERENCES_COMMIT"
}
]
}
}
],
"versions": [
"2.7.6",
"2.7.5",
"2.7.4",
"2.7.3",
"2.7.2",
"2.7.1",
"2.7.0",
"2.6.5",
"2.6.4",
"2.6.3",
"2.6.2",
"2.6.1",
"2.6.0",
"2.5.2",
"2.5.1",
"2.5.0",
"2.4.1",
"2.4.0",
"2.4.0-RC1",
"2.3.5",
"2.3.4",
"2.3.3",
"2.3.2",
"2.3.1",
"2.3.0"
],
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2024-35242.json"
}
}
],
"modified": "2026-10-28T02:30:30.890879439Z",
"provider": "osv",
"references": [
"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/PO4MU2BC7VR6LMHEX4X7DKGHVFXZV2MC/",
"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/VLPJHM2WWSYU2F6KHW2BYFGYL4IGTKHC/",
"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/35xxx/CVE-2024-35242.json",
"https://github.com/composer/composer/security/advisories/GHSA-v9qv-c7wm-wgmf",
"https://nvd.nist.gov/vuln/detail/CVE-2024-35242",
"https://github.com/composer/composer/commit/6bd43dff859c597c09bd03a7e7d6443822d0a396",
"https://github.com/composer/composer/commit/fc57b93603d7d90b71ca8ec77b1c8a9171fdb467"
],
"provider_metadata": {
"cwe_ids": [
"CWE-77"
],
"cna_assigner": "GitHub_M",
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/35xxx/CVE-2024-35242.json"
}
},
"related_cves": [
{
"value": "CVE-2024-35242",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 498040,
"published_at": "2024-06-10T21:23:44.04+00:00"
}