Mend.io Vulnerability Database
The largest open source vulnerability database
What is a Vulnerability ID?
New vulnerability? Tell us about it!
CVE-2026-40176
Published:April 15, 2026
Updated:April 23, 2026
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).
Affected Packages
https://github.com/composer/composer.git (GITHUB):
Affected version(s) >=2.3.0-RC1 <2.9.6
Fix Suggestion:
Update to version 2.9.6
composer/composer (PHP):
Affected version(s) >=2.3.0 <2.9.6
Fix Suggestion:
Update to version 2.9.6
composer/composer (PHP):
Affected version(s) >=2.3.0 <2.9.6
Fix Suggestion:
Update to version 2.9.6
composer/composer (PHP):
Affected version(s) >=1.0.0 <2.2.27
Fix Suggestion:
Update to version 2.2.27
Do you need more information?
Contact Us
CVSS v4
Base Score:
8.5
Attack Vector
LOCAL
Attack Complexity
LOW
Attack Requirements
NONE
Privileges Required
NONE
User Interaction
PASSIVE
Vulnerable System Confidentiality
HIGH
Vulnerable System Integrity
HIGH
Vulnerable System Availability
HIGH
Subsequent System Confidentiality
NONE
Subsequent System Integrity
NONE
Subsequent System Availability
NONE
CVSS v3
Base Score:
7.8
Attack Vector
LOCAL
Attack Complexity
LOW
Privileges Required
NONE
User Interaction
REQUIRED
Scope
UNCHANGED
Confidentiality
HIGH
Integrity
HIGH
Availability
HIGH
Weakness Type (CWE)
Improper Input Validation
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
EPSS
Base Score:
0.01