CVE-2026-40176: composer/composer · Composer has a command injection via malicious perforce repository
Affects composer/composerSource GCVE Database
Not known to be exploited · CVSS 7.8 High : upgrade to 2.9.6 soon.
Data as of 3 Nov 2026, 00:29 UTC
Sources agree
| CNA (GitHub_M) | CVSS 3.1 | 7.8 |
|---|---|---|
| ADP (redhat-SADP) | CVSS 3.1 | 7.8 |
- Patch
- Available – fixed in 2.9.6, 2.2.27
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:HExploitation evidence
Disclosed: evidence found.
CVE published 15 Apr 2026
Detectable: no evidence on record.
No public nuclei template indexed
Weaponized: no evidence on record.
No public exploit code indexed in Metasploit or Exploit-DB
Exploited in the wildExploited: no evidence on record.
Not in CISA KEV and no source reports exploitation
Observed by OffSeq MirageSeen by Mirage: no evidence on record.
No attack traffic recorded by OffSeq Mirage sensors
A missing step is not evidence of safety. Sources: cve.org (opens in a new tab), the Metasploit, Exploit-DB and nuclei-templates index as of 2 Nov 2026.
What to do
Upgrade composer/composer to 2.9.6; composer/composer to 2.2.27.
Patches and advisories
Affected software
| Product | Affected | Fixed in |
|---|---|---|
| Packagistcomposer/composer | Affected
| Fixed in
|
| Packagistcomposer/composer | Affected
| Fixed in
|
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
AI-suggested
Apply the official patches by upgrading Composer to version 2.2.27 (LTS) or 2.9.6 (mainline) or later. Until patched, only run Composer commands on trusted projects and carefully inspect composer.json files for malicious Perforce repository configurations. Verify that Perforce-related fields contain valid values before execution.
Description
Composer versions prior to 2.2.27 and 2.9.6 contain a command injection vulnerability in the Perforce::generateP4Command() method. This flaw allows an attacker to inject arbitrary shell commands via malicious Perforce repository configuration parameters in a composer.json file. Exploitation requires running Composer commands on untrusted projects with attacker-supplied composer.json files. The vulnerability is limited to the user context running Composer and does not affect dependencies' composer.json files. Fixed in Composer 2.2.27 and 2.9.6.
References
- github.com/composer/composer/security/advisories/GHSA-wg36-wvj6-r67p (opens in a new tab)
- nvd.nist.gov/vuln/detail/CVE-2026-40176 (opens in a new tab)
- access.redhat.com/errata/RHSA-2026:8165 (opens in a new tab)
- access.redhat.com/security/cve/CVE-2026-40176 (opens in a new tab)
- bugzilla.redhat.com/show_bug.cgi?id=2458828 (opens in a new tab)
- github.com/FriendsOfPHP/security-advisories/blob/master/composer/composer/CVE-2026-40176.yaml (opens in a new tab)
- github.com/composer/composer (opens in a new tab)
- github.com/composer/composer/releases/tag/2.2.27 (opens in a new tab)
- github.com/composer/composer/releases/tag/2.9.6 (opens in a new tab)
- security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-40176.json (opens in a new tab)