High severity · published Apr 15, 2026
CVE-2026-40176
Composer is vulnerable to Command Injection via Malicious Perforce Repository
7.8
CVSS
1%
EPSS
No
On KEV
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 vector
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Attack vector
Local
Complexity
Low
Privileges
None
User interaction
Required
Confidentiality
High
Integrity
High
Availability
High
Scope
Unchanged
Exploitation
Is it being used?
Exploit prediction (EPSS)1.0% · higher than 64% of CVEs
Exploited in the wildNo evidence yet
CISA KEVNot listed
Ransomware campaign useNot known
Affected products
Which versions
CO
composer · composer
>= 2.3, < 2.9.6; >= 1.0, < 2.2.27 · source: vendor, NVD
RH
Red Hat Hardened Images · Red Hat
All versions, or not specified · source: CISA
References
NVD
https://nvd.nist.gov/vuln/detail/CVE-2026-40176
CVE.org
https://www.cve.org/CVERecord?id=CVE-2026-40176
Release Notes
https://github.com/composer/composer/releases/tag/2.9.6
Vendor Advisory
https://github.com/composer/composer/security/advisories/GHSA-wg36-wvj6-r67p
access.redhat.com
https://access.redhat.com/errata/RHSA-2026:8165
access.redhat.com
https://access.redhat.com/security/cve/CVE-2026-40176
bugzilla.redhat.com
https://bugzilla.redhat.com/show_bug.cgi?id=2458828
security.access.redhat.com
https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-40176.json
More from composer
8.8
CVE-2026-40261
Composer has Command Injection via Malicious Perforce Reference
7.7
CVE-2026-84361
Composer: Perforce source URL permits P4PORT `rsh:` command execution
7.5
CVE-2026-45793
Composer: Github Actions issued GITHUB_TOKEN disclosure in GitHub Actions logs
7.0
CVE-2026-59948
Composer: Arbitrary file write outside vendor via malicious transitive package name
6.1
CVE-2026-59944
Composer: CVE-2026-59946 fix bypass via symlinked package bin path
