CVE-2026-40176: Command Injection in Composer Perforce Command Generation
- Vendor
- Getcomposer
CVE-2026-40176 is an OS command injection vulnerability in Composer, the PHP dependency manager, affecting versions 1.0 through 2.2.26 and 2.3 through 2.9.5. The Perforce::generateP4Command() method interpolates attacker-controlled Perforce port, user, and client parameters into shell commands without proper escaping. A malicious Perforce VCS repository configuration in a root project or the Composer configuration directory can trigger arbitrary command execution when a user runs Composer. Exploitation does not require Perforce to be installed. Repository declarations in installed dependencies' manifests do not trigger this vulnerability.
Impact, mitigation & remediation
What it means and what to do now: patch path, interim mitigations, and the assume-compromise checklist.
Impact
What an attacker gets, and what they’ve been doing with it.
Successful exploitation permits arbitrary shell command execution with the privileges of the user running Composer. This can compromise the confidentiality and integrity of accessible project data, credentials, and other resources, and affect system availability. Execution in a privileged development or build environment extends the impact to resources accessible to that account.
Mitigation
If you can’t patch tonight, do this now.
Run Composer only on projects from trusted sources. Before processing an untrusted project, inspect its root composer.json for Perforce repository declarations and validate the port, user, and client values. Also review repository declarations in the Composer configuration directory and remove untrusted configurations.
Remediation
Patch, then assume compromise.
Upgrade Composer to version 2.2.27 on the 2.2 LTS branch, version 2.9.6 on the mainline branch, or a later fixed release.
Exploits
4 exploits validated by Mallory's analysis.
Affected products & vendors
Products and vendors Mallory has correlated with this vulnerability. Open in Mallory to drill down to specific CPE configurations and version ranges.
References
Frequently asked questions
- Is CVE-2026-40176 exploited in the wild?
- As of Nov 3, 2026, Mallory has no reports of CVE-2026-40176 being exploited in the wild. It is not listed in CISA KEV.
- Is there a public exploit for CVE-2026-40176?
- Yes. Mallory tracks 4 public exploits or proofs of concept for CVE-2026-40176, the earliest disclosed Apr 16, 2026.
- Is there a patch for CVE-2026-40176?
- Upgrade Composer to version 2.2.27 on the 2.2 LTS branch, version 2.9.6 on the mainline branch, or a later fixed release.
- What products are affected by CVE-2026-40176?
- Getcomposer Composer.
- How severe is CVE-2026-40176?
- CVE-2026-40176 has a CVSS v3.1 score of 7.8 (High) and an EPSS score of 1.1% (65th percentile) as of Nov 3, 2026.
Recent activity
19 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.