Skip to content
Fencer Intel
high 8.8

CVE-2026-40261 json

Composer has Command Injection via Malicious Perforce Reference

published 6mo ago modified last mo. also BIT-composer-2026-40261 , EUVD-2026-23119 , GHSA-gqw4-4w2p-838q

cvss
8.8
version 3.1, CNA
cisa kev
Not listed
not in CISA's catalog
epss
1.7%
EPSS 1.7% chance of exploitation in 30 days, percentile 77%
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::syncCodeBase() method, which appends the $sourceReference parameter to a shell command without proper escaping, and additionally in the Perforce::generateP4Command() method as in GHSA-wg36-wvj6-r67p / CVE-2026-40176, which interpolates user-supplied Perforce connection parameters (port, user, client) from the source url field without proper escaping. An attacker can inject arbitrary commands through crafted source reference or source url values containing shell metacharacters, even if Perforce is not installed. Unlike CVE-2026-40176, the source reference and url are provided as part of package metadata, meaning any compromised or malicious Composer repository can serve package metadata declaring perforce as a source type with malicious values. This vulnerability is exploitable when installing or updating dependencies from source, including the default behavior when installing dev-prefixed versions. This issue has been fixed in Composer 2.2.27 (2.2 LTS) and 2.9.6 (mainline). If developers are unable to immediately update, they can avoid installing dependencies from source by using --prefer-dist or the preferred-install: dist config setting, and only use trusted Composer repositories as a workaround.

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-40261

  • 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-40261

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-40261 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-40261 updated cvss 8.8

composer: command injection via malicious Perforce source reference/url

  • 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.69% chance of exploitation in the next 30 days, higher than 77% of all scored CVEs (FIRST EPSS, 2026-11-09).

CVSS scores

assigned by version score vector
CNA 3.1 8.8 CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
CISA ADP 3.1 8.8 CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
GitHub 3.1 8.8 CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
OSV 3.1 8.8 CVSS:3.1/AV:N/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-78 Improper Neutralization of Special Elements used in an OS Command
  • CWE-20 Improper Input Validation

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.