Skip to content
Fencer Intel
high 7.8

CVE-2026-40176 json

Composer is vulnerable to Command Injection via Malicious Perforce Repository

published 6mo ago modified 6d ago also BIT-composer-2026-40176 , EUVD-2026-23118 , GHSA-wg36-wvj6-r67p

cvss
7.8
version 3.1, CNA
cisa kev
Not listed
not in CISA's catalog
epss
1.0%
EPSS 1.0% chance of exploitation in 30 days, percentile 64%
public exploits
0
none known

Summary

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).

Patch / fix

  • packagist composer/composer 2.2.27, 2.9.6
  • bitnami composer 2.2.27, 2.9.6
  • Red Hat Red Hat Hardened Images 2.9.7-1.hum1
  • composer Debian 12 2.5.5-1+deb12u4
  • composer Debian 13 2.8.8-1+deb13u2
  • composer Debian 14 2.9.7-1

debian advisories DEBIAN-CVE-2026-40176

  • composer hummingbird 1 2.9.7-1.hum1

red hat advisories RHSA-2026:8165

  • php-composer2 SLES 16.0, SLES for SAP applications 16.0 2.8.9-160000.4.1
  • php-composer2 SLES for SAP 15 SP6, SLES 15 SP6-LTSS, SLE Module for Web and Scripting 15 SP7 2.6.4-150600.3.12.1

suse advisories SUSE-SU-2026:23116-1SUSE-SU-2026:23138-1SUSE-SU-2026:3105-1

  • php-composer2 openSUSE Leap 16.0 2.8.9-160000.4.1
  • php-composer2 openSUSE Tumbleweed 2.9.7-1.1

opensuse advisories openSUSE-SU-2026:21520-1openSUSE-SU-2026:10643-1

  • composer Alpine 3.24, Alpine 3.23 2.9.6-r0

alpine advisories ALPINE-CVE-2026-40176

Alpine secdb © Alpine Linux, from https://secdb.alpinelinux.org via OSV; changed: normalised to fixed package versions per release. CC BY-SA 4.0

Is CVE-2026-40176 in your dependencies? Fencer shows which of your repositories are affected as soon as an advisory lands, and opens the fix as a pull request.

Check with Fencer

Vendor advisories

What the vendors themselves say about their products: affected, fixed or not affected, and what to do.

red hat product security vex CVE-2026-40176 updated cvss 7.8

composer: command injection via malicious Perforce repository definition

  • Red Hat Hardened Images composer 2.9.7-1.hum1
    fixed: vendor fix RHSA-2026:8165

Red Hat CSAF VEX © Red Hat, Inc., from https://security.access.redhat.com/data/csaf/v2/vex/; changed: reduced to product statuses and remediations. CC BY 4.0 · csaf

CISA SSVC

Exploitation
none
Automatable
no
Technical impact
total
Assessed
6mo ago

Exploit prediction

1.05% chance of exploitation in the next 30 days, higher than 64% of all scored CVEs (FIRST EPSS, 2026-11-09).

CVSS scores

assigned by version score vector
CNA 3.1 7.8 CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
CISA ADP 3.1 7.8 CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
GitHub 3.1 7.8 CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
OSV 3.1 7.8 CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

Affected packages

ecosystem package affected fixed in
packagist composer/composer
>=2.3.0, <2.9.6
>=1.0.0, <2.2.27
2.9.6
2.2.27
bitnami composer
>=1.0.0, <2.2.27
>=2.3.0, <2.9.6
2.2.27
2.9.6

Affected products

  • composer composer
  • Red Hat Red Hat Hardened Images

Classification

Weakness
  • CWE-20 Improper Input Validation
  • CWE-78 Improper Neutralization of Special Elements used in an OS Command

References

Sources

Fencer Intel keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.

CPEs and fixed versions use Anchore's correction of NVD's data: Added CPE configurations because not yet analyzed by NVD.