CVE-2026-40261
A public proof of concept exists; no exploitation attested.
- Published2026-04-15
- Fixed in2.9.6 · 2.2.27
- WeaknessCWE-20 · CWE-78
Am I affected?
Debian, Ubuntu or Red Hat sometimes backport a fix without changing the upstream version number: such a version reads « to verify », never « affected ».With a domain, we read the version its public headers and pages expose. A distribution build can carry the fix under an older number.
Description
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.
Timeline
dates in UTC- 2026-04-1521:17CVE publishedNVD
Versions per branch
OSV · NVD| Branch | Affected | Fixed in | Source |
|---|---|---|---|
| 2.x | ≥ 2.3.0, < 2.9.6 | 2.9.6 | OSV |
| 2.2 | ≥ 1.0.0, < 2.2.27 | 2.2.27 | OSV |
| Branch | Affected | Fixed in | Source |
|---|---|---|---|
| 2.2 | ≥ 1.0.0, ≤ 2.2.26 | no fix published | NVD |
| 2.x | ≥ 2.3.0, ≤ 2.9.5 | no fix published | NVD |
| Branch | Affected | Fixed in | Source |
|---|---|---|---|
| 2.x | ≥ 2.3.0, < 2.9.6 | 2.9.6 | OSV |
| 2.2 | ≥ 1.0.0, < 2.2.27 | 2.2.27 | OSV |
as publishedRanges as NVD and OSV publish them; a distribution’s build can be fixed under an older number.
Products declared by the CNA1 product
As GitHub_M, the CNA that assigned this CVE, declared them in the CVE record; versions as written.
- composerAffected
- = >= 2.3.0, < 2.9.6no fix stated
- = >= 1.0.0, < 2.2.27no fix stated
Source: the CNA record (CVE Program), © The MITRE Corporation,CVE Terms of UseCVE recordupdated 2026-04-15
Distribution builds and vendor advisories
Packages from OSV.dev and products from the vendors' CSAF advisories.
version not verifiedVersions not verified: read as OSV.dev and the vendors publish them, not checked against each vendor's release list.
Packages
- composerWolfiall versions · fixed in 2.9.7-r0
- composerUbuntu:Pro:24.04:LTSall versions · no fixed version listed
- composerUbuntu:Pro:22.04:LTSall versions · no fixed version listed
- composerUbuntu:Pro:20.04:LTSall versions · no fixed version listed
- composerUbuntu:Pro:18.04:LTSall versions · no fixed version listed
- composerUbuntu:Pro:16.04:LTSall versions · no fixed version listed
- composerUbuntu:26.10all versions · no fixed version listed
- composerUbuntu:26.04:LTSall versions · no fixed version listed
18 more package ranges on OSV.dev
Vendor advisories
composer: command injection via malicious Perforce source reference/url
Red Hat Security Advisory: Red Hat Hardened Images RPMs bug fix and enhancement update
Fix
- Update composer to 2.9.6 · 2.2.27
- Vendor fix Red Hat Product Security CVE-2026-40261 · 2 productsFor details on how to apply this update, which includes the changes described in this advisory, refer to: https://images.redhat.com/
- Workaround from the vendor Red Hat Product Security CVE-2026-40261 · 2 productsTo mitigate this issue, only run Composer commands on projects and dependencies from trusted sources. Also, use the '--prefer-dist' or the 'preferred-install: dist' configuration setting to prevent Composer from installing dependencies from source.
Advisories and patches
- github.comRelease Notes
- github.comVendor Advisory
Detection
read 2026-11-01 01:02 UTC- Nuclei template
- none so far ProjectDiscovery
- Exploit-DB
- no entry Exploit-DB
- Proof of concept
- PoC-in-GitHub1 repository, unverifiedknown since 2026-11-01terminat0r7031/composer-CVE-2026-40261-CVE-2026-40176-PoC
- Metasploit modules
- none listed Metasploit Framework
Sources
- CISA-ADPSSVC decisionnone2026-04-16
- CNACVSS 3.18.8known since 2026-10-23
- CNAweakness (CWE)CWE-20, CWE-78known since 2026-10-23
- NVDweakness (CWE)CWE-78read 2026-10-23
- FIRST EPSSEPSS score1.7 %2026-11-08
- PoC-in-GitHubproof of concept1known since 2026-11-01
- OSVaffected packages—
- GitHub AdvisoriesadvisoryHIGH2026-04-14
Identifiers
- BIT-composer-2026-40261same flawBitnami · Apache-2.0
- CGA-5vj2-7rpg-5wwhsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-ph4f-23vf-gqqvsame flawChainguard · CC-BY-NC-ND-4.0
- EUVD-2026-23119same flawENISA EUVD · LicenseRef-ENISA-legal-notice
- GHSA-gqw4-4w2p-838qsame flawGitHub Advisory Database · CC-BY-4.0
- MINI-2jj7-qpww-7f59same flawMinimOS · LicenseRef-unstated
- MINI-h2qp-83g4-h3f7same flawMinimOS · LicenseRef-unstated
- openSUSE-SU-2026:10643-1advisory covering several CVEsopenSUSE · LicenseRef-unstated
- openSUSE-SU-2026:21520-1advisory covering several CVEsopenSUSE · LicenseRef-unstated
- RHSA-2026:8165advisory covering several CVEsRed Hat · CC-BY-4.0
- SUSE-SU-2026:23116-1advisory covering several CVEsSUSE · LicenseRef-unstated
- SUSE-SU-2026:23138-1advisory covering several CVEsSUSE · LicenseRef-unstated
- SUSE-SU-2026:3105-1advisory covering several CVEsSUSE · LicenseRef-unstated
Technical details
- CVSS v3 Vector
- CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
- Published
- 2026-04-15
- Last Modified
- 2026-07-15
- NVD status
- Modified
- GitHub Advisory
- GHSA-gqw4-4w2p-838q
Frequently asked questions
What is CVE-2026-40261?
Is CVE-2026-40261 actively exploited?
What is the CVSS score for CVE-2026-40261?
Running composer? Hear about its next vulnerability
Surveillance reads the versions in your stack — a domain, a lockfile or a list — checks each CVE against the ranges its sources publish, and alerts you when one you run is exploited or enters CISA KEV. A version it cannot read stays « version not verified ».
No credit card required · No monthly cap on website lookups · 250 API requests/month
Go further
- Following what attackers exploit right now? The CISA KEV additions of the month, with their patch deadlines.
- Running this software? Vulnerability monitoring alerts you to new vulnerabilities in your products.
Related vulnerabilities
Same product first, then the same vendor advisory and the same publication week.
Sources for this record
- CVE Program · CVE Program Terms of Use
- ENISA EU Vulnerability Database · ENISA legal notice §1.2 (reproduction authorised, provided the source is acknowledged)
- FIRST EPSS · EPSS terms of use (free use, attribution requested)
- GitHub Advisory Database · CC-BY-4.0 · GHSA-gqw4-4w2p-838q
- NVD · Public domain (17 U.S.C. § 105) for NVD-authored data; third-party content under its own terms
- OSV.dev · Per record, as its publisher states it: each row carries the label in sourceLicense when one is served
- PoC-in-GitHub · CC0-1.0
- Red Hat Product Security (CSAF and VEX) · CC-BY-4.0
- CISA Vulnrichment · CC0-1.0