CVE-2026-40176
Composer is vulnerable to Command Injection via Malicious Perforce Repository
A public proof of concept exists; no exploitation attested.
- Published2026-04-15
- Fixed in2.9.6 · 2.2.27
- WeaknessCWE-20 · CWE-78
Am I affected?
Debian, Ubuntu or Red Hat sometimes backport a fix without changing the upstream version number: such a version reads « to verify », never « affected ».With a domain, we read the version its public headers and pages expose. A distribution build can carry the fix under an older number.
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).
Timeline
dates in UTC- 2026-04-1520:47CVE publishedCNA
- 2026-04-1521:17CVE publishedNVD
Versions per branch
OSV · NVD| Branch | Affected | Fixed in | Source |
|---|---|---|---|
| 2.x | ≥ 2.3.0, < 2.9.6 | 2.9.6 | OSV |
| 2.2 | ≥ 1.0.0, < 2.2.27 | 2.2.27 | OSV |
| Branch | Affected | Fixed in | Source |
|---|---|---|---|
| 2.2 | ≥ 1.0.0, ≤ 2.2.26 | no fix published | NVD |
| 2.x | ≥ 2.3.0, ≤ 2.9.5 | no fix published | NVD |
| Branch | Affected | Fixed in | Source |
|---|---|---|---|
| 2.x | ≥ 2.3.0, < 2.9.6 | 2.9.6 | OSV |
| 2.2 | ≥ 1.0.0, < 2.2.27 | 2.2.27 | OSV |
as publishedRanges as NVD and OSV publish them; a distribution’s build can be fixed under an older number.
Products declared by the CNA1 product
As GitHub_M, the CNA that assigned this CVE, declared them in the CVE record; versions as written.
- composerAffected
- = >= 2.3, < 2.9.6no fix stated
- = >= 1.0, < 2.2.27no fix stated
Source: the CNA record (CVE Program), © The MITRE Corporation,CVE terms of useCVE recordupdated 2026-04-15
Distribution builds and vendor advisories
Packages from OSV.dev and products from the vendors' CSAF advisories.
version not verifiedVersions not verified: read as OSV.dev and the vendors publish them, not checked against each vendor's release list.
Packages
- composerWolfiall versions · fixed in 2.9.7-r0
- composerUbuntu:Pro:24.04:LTSall versions · no fixed version listed
- composerUbuntu:Pro:22.04:LTSall versions · no fixed version listed
- composerUbuntu:Pro:20.04:LTSall versions · no fixed version listed
- composerUbuntu:Pro:18.04:LTSall versions · no fixed version listed
- composerUbuntu:Pro:16.04:LTSall versions · no fixed version listed
- composerUbuntu:26.10all versions · no fixed version listed
- composerUbuntu:26.04:LTSall versions · no fixed version listed
20 more package ranges on OSV.dev
Vendor advisories
composer: command injection via malicious Perforce repository definition
Red Hat Security Advisory: Red Hat Hardened Images RPMs bug fix and enhancement update
Fix
- Update composer to 2.9.6 · 2.2.27
- Vendor fix Red Hat Product Security CVE-2026-40176 · 3 productsFor details on how to apply this update, which includes the changes described in this advisory, refer to: https://images.redhat.com/
- Workaround from the vendor Red Hat Product Security CVE-2026-40176 · 3 productsTo mitigate this vulnerability, only run Composer commands on projects from trusted sources. Also, inspect composer.json files before running Composer commands on them, specifically checking that Perforce-related fields contain valid values.
Advisories and patches
- github.comRelease Notes
- github.comVendor Advisory
Detection
read 2026-12-04 21:57 UTC- Nuclei template
- none so far ProjectDiscovery
- Exploit-DB
- no entry Exploit-DB
- Proof of concept
- PoC-in-GitHub1 repository, unverifiedknown since 2026-12-04ikarolaborda/CVE-2026-40176
- Metasploit modules
- none listed Metasploit Framework
Sources
- CISA-ADPSSVC decisionnone2026-04-16
- CNACVSS 3.17.82026-11-02
- GitHub AdvisoriesCVSS 3.17.82026-11-02
- CNAweakness (CWE)CWE-20, CWE-782026-11-02
- GitHub Advisoriesweakness (CWE)CWE-20, CWE-782026-11-02
- NVDweakness (CWE)CWE-78read 2026-11-03
- FIRST EPSSEPSS score1.1 %2026-12-04
- PoC-in-GitHubproof of concept1known since 2026-12-04
- OSVaffected packages—
- GitHub AdvisoriesadvisoryHigh2026-04-14
Identifiers
- BIT-composer-2026-40176same flawBitnami · Apache-2.0
- CGA-6w8f-9cjg-7cxwsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-p84m-qq88-p2q7same flawChainguard · CC-BY-NC-ND-4.0
- EUVD-2026-23118same flawENISA EUVD · LicenseRef-ENISA-legal-notice
- GHSA-wg36-wvj6-r67psame flawGitHub Advisory Database · CC-BY-4.0
- MINI-468x-f99p-m88fsame flawMinimOS · LicenseRef-unstated
- MINI-7g3q-p72q-4m55same flawMinimOS · LicenseRef-unstated
- openSUSE-SU-2026:10643-1advisory covering several CVEsopenSUSE · LicenseRef-unstated
- openSUSE-SU-2026:21520-1advisory covering several CVEsopenSUSE · LicenseRef-unstated
- RHSA-2026:8165advisory covering several CVEsRed Hat · CC-BY-4.0
- SUSE-SU-2026:23116-1advisory covering several CVEsSUSE · LicenseRef-unstated
- SUSE-SU-2026:23138-1advisory covering several CVEsSUSE · LicenseRef-unstated
- SUSE-SU-2026:3105-1advisory covering several CVEsSUSE · LicenseRef-unstated
Technical details
- CVSS v3 vector
- CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
- Published
- 2026-04-15
- Last modified
- 2026-11-02
- NVD status
- Modified
- GitHub advisory
- GHSA-wg36-wvj6-r67p
Frequently asked questions
What is CVE-2026-40176?
Is CVE-2026-40176 actively exploited?
What is the CVSS score for CVE-2026-40176?
Running composer? Hear about its next vulnerability
Surveillance reads the versions in your stack — a domain, a lockfile or a list — checks each CVE against the ranges its sources publish, and alerts you when one you run is exploited or enters CISA KEV. A version it cannot read stays « version not verified ».
No credit card required · No monthly cap on website checks · 250 API requests/month
Go further
- Following what attackers exploit right now? The CISA KEV additions of the month, with their patch deadlines.
- Running this software? Vulnerability monitoring alerts you to new vulnerabilities in your products.
Related vulnerabilities
Same product first, then the same vendor advisory and the same publication week.
Sources for this record
- CVE Program · CVE Program Terms of Use
- ENISA EU Vulnerability Database · ENISA legal notice §1.2 (reproduction authorised, provided the source is acknowledged)
- FIRST EPSS · EPSS terms of use (free use, attribution requested)
- GitHub Advisory Database · CC-BY-4.0 · GHSA-wg36-wvj6-r67p
- NVD · Public domain (17 U.S.C. § 105) for NVD-authored data; third-party content under its own terms
- OSV.dev · Per record, as its publisher states it: each row carries the label in sourceLicense when one is served
- PoC-in-GitHub · CC0-1.0
- Red Hat Product Security (CSAF and VEX) · CC-BY-4.0
- CISA Vulnrichment · CC0-1.0