CVE-2024-35242: Composer/composer Composer Has Multiple Command Injections Vulnerability
HIGHCVE-2024-35242 is a HIGH (CVSS 8.8) composer has multiple command injections vulnerability (CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection')) affecting Composer/composer libraries in the Packagist ecosystem. The issue involves composer has multiple command injections via malicious git/hg branch names. Remediation is available by upgrading affected packages to version 2.2.24, 2.7.7.
CVE-2024-35242 at a Glance
Security Impact
CVSS: 8.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H).
How to Fix CVE-2024-35242
To remediate this vulnerability, upgrade all affected Composer/composer dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade composer/composer to 2.2.24
Upgrade composer/composer to 2.7.7
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for composer/composer
How to Check if You Are Affected
To determine whether your application is affected by CVE-2024-35242, inspect your project dependencies for Composer/composer:
inspect dependencies for composer/composer
Analyze the terminal output to locate any version of Composer/composer in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.2.24), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection'), where the product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component. In Composer/composer, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2024-35242 Affected Composer/composer Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
composer/composer
|
Packagist |
≥ 2.0
< 2.2.24
|
2.2.24
|
|
composer/composer
|
Packagist |
≥ 2.3
< 2.7.7
|
2.7.7
|
References
Frequently Asked Questions
What is CVE-2024-35242?
Which Composer/composer versions are affected?
What version fixes CVE-2024-35242?
Is composer/composer affected?
What is the CVSS score of CVE-2024-35242?
What CWE is associated with CVE-2024-35242?
How can I check Packagist dependencies for CVE-2024-35242?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-v9qv-c7wm-wgmf",
"modified" : "2025-02-13T18:50:48Z",
"published" : "2024-06-10T21:36:25Z",
"aliases" : [ "CVE-2024-35242" ],
"summary" : "Composer has multiple command injections via malicious git/hg branch names",
"details" : "### Impact\n\nThe `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.\n\n### Patches\n\n2.2.24 for 2.2 LTS or 2.7.7 for mainline\n\n### Workarounds\n\nAvoid cloning potentially compromised repositories.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "composer/composer"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.0"
}, {
"fixed" : "2.2.24"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Packagist",
"name" : "composer/composer"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.3"
}, {
"fixed" : "2.7.7"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/composer/composer/security/advisories/GHSA-v9qv-c7wm-wgmf"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-35242"
}, {
"type" : "WEB",
"url" : "https://github.com/composer/composer/commit/6bd43dff859c597c09bd03a7e7d6443822d0a396"
}, {
"type" : "WEB",
"url" : "https://github.com/composer/composer/commit/fc57b93603d7d90b71ca8ec77b1c8a9171fdb467"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/composer/composer"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/PO4MU2BC7VR6LMHEX4X7DKGHVFXZV2MC"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/VLPJHM2WWSYU2F6KHW2BYFGYL4IGTKHC"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-77" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2024-06-10T21:36:25Z",
"nvd_published_at" : "2024-06-10T22:15:09Z"
}
}