CVE-2026-40176: Composer is vulnerable to Command Injection via Malicious Perforce Repository
Vulnerability summary
CVE-2026-40176 is a high (CVSS 7.8) Improper Input Validation vulnerability in composer. EPSS estimates a 1.09% chance of exploitation in the next 30 days, higher than 66.4% of scored vulnerabilities.
Not severe (CVSS 7.8, local access); no exploitation reported by the 5 checked sources
Source freshness unavailable
How is this decided?Advisory lineage
Upstream 0 · Downstream 6 · Related 6Timeline
- 15-04-2026PublishedVulnerability first disclosed.
- 02-11-2026Last modifiedVulnerability information updated.
Description
Composer is a dependency manager for PHP. Versions 1.0 through 2.2.26 and 2.3 through 2.9.5 contain a command injection vulnerability in the Perforce::generateP4Command() method, which constructs shell commands by interpolating user-supplied Perforce connection parameters (port, user, client) without proper escaping. An attacker can inject arbitrary commands through these values in a malicious composer.json declaring a Perforce VCS repository, leading to command execution in the context of the user running Composer, even if Perforce is not installed. VCS repositories are only loaded from the root composer.json or the composer config directory, so this cannot be exploited through composer.json files of packages installed as dependencies. Users are at risk if they run Composer commands on untrusted projects with attacker-supplied composer.json files. This issue has been fixed in Composer 2.2.27 (2.2 LTS) and 2.9.6 (mainline).
CVSS metrics
7 scores · 7 sources · 1 version- OSV · UbuntuEcosystem advisory · calculated7.8HighCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
- OSV · DebianEcosystem advisory · calculated7.8HighCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
- OSV · WolfiEcosystem advisory · calculated7.8HighCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
- OSV · ChainguardEcosystem advisory · calculated7.8HighCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
- NVDNIST7.8HighCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
- OSV · AlpineEcosystem advisory · calculated7.8HighCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
EPSS trend
Probability
1.09%
Chance of exploitation in the next 30 days
Percentile
66%
Versus all other CVEs
30-day change
Increase +0.04 pp
From 1.04% on 04-11-2026
Known exploited
Compare KEV catalogsNot in the CISA KEV catalog.
Not in the ENISA CNW catalog.
Not in the CIRCL catalog.
Public exploits
0 foundNo public exploits indexed.
Weaknesses
CWE · root cause- CWE-20Improper Input ValidationThe product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
- CWE-78Improper Neutralization of Special Elements used in an OS CommandThe product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command before it is sent to a downstream component.
Affected systems
Known conditions: local access, no authentication, user interaction (CVSS vector). Other conditions: not stated in public data.
Alpine1 product
- composer≥ 1.0.0, < 2.9.6-r0 | ≥ 2.3.0, < 2.9.6-r0
Chainguard1 product
- composer< 2.9.7-r0
Composer1 product
- composer≥ 2.3, < 2.9.6 | ≥ 1.0, < 2.2.27
Debian1 product
- composer< 2.5.5-1+deb12u4 | < 2.8.8-1+deb13u2 | < 2.9.7-1
Getcomposer1 product
- composer≥ 1.0.0, ≤ 2.2.26 | ≥ 2.3.0, ≤ 2.9.5
Ubuntu1 product
- composerAll versions (No fix recorded)
Wolfi1 product
- composer< 2.9.7-r0
7 vendors · 7 products
References
14 links- github.com/composer/composer/security/advisories/GHSA-wg36-wvj6-r67pX Refsource CONFIRMREPORTAdvisoryVendor Advisory
- security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-40176.jsonX Sadp Csaf VexWEBX Refsource MISC
Show all 14 references
- github.com/FriendsOfPHP/security-advisories/blob/master/composer/composer/CVE-2026-40176.yamlX Refsource MISCAdvisory