CVEfocus › CVE database › CVE-2026-40261

CVE-2026-40261Composer has Command Injection via Malicious Perforce Reference

CVSS 8.8 HighEPSS 1.7% (higher than 78% of CVEs)Published 2026-04-15Updated 2026-07-15Assigner: 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::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.

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-40261
Ubuntu 26.04composerUnder investigationUBUNTU-CVE-2026-40261
Ubuntu 25.10composerWill not fix
Ubuntu decided not to fix this in this release
UBUNTU-CVE-2026-40261
Ubuntu 24.04composerFix pendingUBUNTU-CVE-2026-40261
Ubuntu 22.04composerFix pendingUBUNTU-CVE-2026-40261
Ubuntu 20.04composerFix pendingUBUNTU-CVE-2026-40261
Ubuntu 18.04composerFix pendingUBUNTU-CVE-2026-40261
Ubuntu 16.04composerFix pendingUBUNTU-CVE-2026-40261
Debian 14composerFixed2.9.7-1DEBIAN-CVE-2026-40261
Debian 13composerFixed2.8.8-1+deb13u2DEBIAN-CVE-2026-40261
Debian 12composerFixed2.5.5-1+deb12u4DEBIAN-CVE-2026-40261
Alpine Linux 3.24composerFixed2.9.6-r0ALPINE-CVE-2026-40261
Alpine Linux 3.23composerFixed2.9.6-r0ALPINE-CVE-2026-40261
Packagist librarycomposer/composerFixed2.2.27GHSA-gqw4-4w2p-838q

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.