Live › vulnerability › CVE-2026-40176
Composer builds a shell command from Perforce connection values (port, user, client) in composer.json without escaping them. A project whose composer.json declares a Perforce repository can run arbitrary commands as the user running Composer, even if Perforce is not installed.
Summary written from the sources below. Check the originals before acting.
First seen by InfraStack 2026-11-02 23:04 UTC, 0h before NVD. All times on this page are UTC.
Only Composer runs on untrusted projects are at risk, since VCS repositories are loaded only from the root composer.json and the global Composer config directory, not from dependencies' composer.json files. Teams that run Composer on projects from trusted sources can skip it; any system where Composer processes attacker-supplied composer.json files should be checked.
| Product | Ecosystem | Affected | Fixed in |
|---|---|---|---|
| composer/composer | composer | >= 2.3.0, < 2.9.6 | 2.9.6 |
| composer/composer | composer | >= 1.0.0, < 2.2.27 | 2.2.27 |
| getcomposer composer | vendor | >= 1.0.0, <= 2.2.26 | – |
| getcomposer composer | vendor | >= 2.3.0, <= 2.9.5 | – |
composer --version and compare against the fixed versions below.~/.config/composer/composer.json) for Perforce repository entries.2.9.6 (mainline)2.2.27 (2.2 LTS)Each row is the first time that source carried this signal. The analyst’s rows are its own findings.
The Perforce::generateP4Command() method constructed shell commands by interpolating user-supplied Perforce connection parameters (port, user, client) without proper escaping. An attacker controlling a repository configuration in a malicious composer.json declaring a Perforce VCS repository could inject arbitrary commands through these values, leading to command execution in the context of the user running Composer. Composer would execute these injected commands even if Perforce is not installed.
VCS repositories are only loaded from the root composer.json file located in the directory you execute Composer commands in and from the composer config directory (e.g. ~/.config/composer/composer.json). So this vulnerability cannot be exploited through composer.json files of packages installed as dependencies.
You are at risk of command execution if you run Composer commands on untrusted projects with attacker supplied composer.json files, regardless of whether you or any of your dependencies use Perforce.
Fixed in Composer 2.2.27 (2.2 LTS) and 2.9.6 (mainline)
This page as .md · .json · in your agent: get_signal("CVE-2026-40176")
GitHub Advisory Database, CC-BY 4.0 · NVD data is provided by NIST and is public domain. Posts quoted belong to their authors.