CVEfocus › CVE database › CVE-2026-40176

CVE-2026-40176Composer is vulnerable to Command Injection via Malicious Perforce Repository

CVSS 7.8 HighEPSS 1.1% (higher than 65% of CVEs)Published 2026-04-15Updated 2026-11-02Assigner: GitHub_M

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

CWE-20CWE-78

What to do

Fixed builds are available from Alpine, Debian, Packagist: see the table below for the fixed version per release.

Ubuntu has not shipped a fix for every release yet.

Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.

curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \
  -H "Content-Type: text/plain" --data-binary @inventory.txt

Vendor status at a glance

6Fixed
6Fix pending
1Under investigation
1Will not fix

Status by vendor and release

From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.

ReleasePackageStatusFixed versionAdvisory
Ubuntu 26.10composerFix pendingUBUNTU-CVE-2026-40176
Ubuntu 26.04composerUnder investigationUBUNTU-CVE-2026-40176
Ubuntu 25.10composerWill not fix
Ubuntu decided not to fix this in this release
UBUNTU-CVE-2026-40176
Ubuntu 24.04composerFix pendingUBUNTU-CVE-2026-40176
Ubuntu 22.04composerFix pendingUBUNTU-CVE-2026-40176
Ubuntu 20.04composerFix pendingUBUNTU-CVE-2026-40176
Ubuntu 18.04composerFix pendingUBUNTU-CVE-2026-40176
Ubuntu 16.04composerFix pendingUBUNTU-CVE-2026-40176
Debian 14composerFixed2.9.7-1DEBIAN-CVE-2026-40176
Debian 13composerFixed2.8.8-1+deb13u2DEBIAN-CVE-2026-40176
Debian 12composerFixed2.5.5-1+deb12u4DEBIAN-CVE-2026-40176
Alpine Linux 3.24composerFixed2.9.6-r0ALPINE-CVE-2026-40176
Alpine Linux 3.23composerFixed2.9.6-r0ALPINE-CVE-2026-40176
Packagist librarycomposer/composerFixed2.2.27GHSA-wg36-wvj6-r67p

What the vendor says

As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.

References

About this page

Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.