CVE-2026-40261
published high CVSS 3.1 · 8.8Composer has Command Injection via Malicious Perforce Reference
Package status and fixes
| Distro / vendor | Release | Package / product | Publisher status | Fixed build | Source |
|---|---|---|---|---|---|
| composer | — | composer>= 2.3.0, < 2.9.6 · >= 1.0.0, < 2.2.27 | Affected | Not stated | GitHub_M |
| Red Hat | — | composer-mainRed Hat Hardened Images · 2.9.7-1.hum1 and later · Other versions: affected | Unaffected | Not stated | redhat-SADP |
| Amazon Linux | AL2023 | Release evaluationALAS2023-2026-1625 | Fixed | Not stated | Amazon Linux assessment |
| Alpine Linux | edge | composer | Fixed | 2.9.6-r0 | Package fix record |
| SUSE / openSUSE | SLE-15-SP4 | php-composer2noarch | Advisory build | 2.2.27-150400.3.18.1 | SUSE-SU-2026:1970-1 |
| Amazon Linux | AL2023 | composernoarch | Listed in advisory | Not stated | ALAS2023-2026-1625 |
| Alpine Linux | v3.23 | composer | Fixed | 2.9.6-r0 | Package fix record |
| Alpine Linux | v3.24 | composer | Fixed | 2.9.6-r0 | Package fix record |
Show 15 more entries
| Distro / vendor | Release | Package / product | Publisher status | Fixed build | Source |
|---|---|---|---|---|---|
| SUSE / openSUSE | SLE-15-SP5 | php-composer2noarch | Advisory build | 2.2.27-150400.3.18.1 | SUSE-SU-2026:1970-1 |
| SUSE / openSUSE | SLE-15-SP6 | php-composer2noarch | Advisory build | 2.6.4-150600.3.12.1 | SUSE-SU-2026:3105-1 |
| SUSE / openSUSE | SLE-15-SP6 | php-composer2noarch | Advisory build | 2.6.4-150600.3.9.1 | SUSE-SU-2026:1784-1 |
| SUSE / openSUSE | SLE-15-SP7 | php-composer2noarch | Advisory build | 2.6.4-150600.3.12.1 | SUSE-SU-2026:3105-1 |
| SUSE / openSUSE | SLE-15-SP7 | php-composer2noarch | Advisory build | 2.6.4-150600.3.9.1 | SUSE-SU-2026:1784-1 |
| SUSE / openSUSE | SLE-16 | php-composer2noarch | Advisory build | 2.8.9-160000.3.1 | SUSE-SU-2026:21542-1 |
| SUSE / openSUSE | SLE-16 | php-composer2noarch | Advisory build | 2.8.9-160000.4.1 | SUSE-SU-2026:23116-1 |
| SUSE / openSUSE | SLE-16 | php-composer2noarch | Advisory build | 2.8.9-160000.4.1 | SUSE-SU-2026:23138-1 |
| SUSE / openSUSE | openSUSE-Leap-16.0 | php-composer2noarch | Advisory build | 2.8.9-160000.3.1 | OPENSUSE-SU-2026:20670-1 |
| SUSE / openSUSE | openSUSE-Leap-16.0 | php-composer2noarch | Advisory build | 2.8.9-160000.4.1 | OPENSUSE-SU-2026:21520-1 |
| SUSE / openSUSE | openSUSE-Tumbleweed | php-composer2aarch64 | Advisory build | 2.9.7-1.1 | OPENSUSE-SU-2026:10643-1 |
| SUSE / openSUSE | openSUSE-Tumbleweed | php-composer2ppc64le | Advisory build | 2.9.7-1.1 | OPENSUSE-SU-2026:10643-1 |
| SUSE / openSUSE | openSUSE-Tumbleweed | php-composer2s390x | Advisory build | 2.9.7-1.1 | OPENSUSE-SU-2026:10643-1 |
| SUSE / openSUSE | openSUSE-Tumbleweed | php-composer2x86_64 | Advisory build | 2.9.7-1.1 | OPENSUSE-SU-2026:10643-1 |
| Amazon Linux | AL2023 | composersrc | Listed in advisory | Not stated | ALAS2023-2026-1625 |
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.
A flaw was found in Composer. `Perforce::syncCodeBase()` appends the `$sourceReference` parameter to a shell command without proper escaping, allowing an attacker to inject arbitrary commands through a crafted source reference containing shell metacharacters.
Related advisories
Vendor advisories explicitly linked to this CVE.
Assessment
CVSS risk assessment and additional context for this vulnerability.
- CVSS version
- 3.1
- Base score
- 8.8 / 10
- Severity
- high
- Provider
- GitHub_M · cna
- Vector string
- CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Additional Assessments
| Version | Score | Severity | Provider | Vector | Scenarios |
|---|---|---|---|---|---|
| 3.1 | 8.8 | high | redhat-SADP · adp | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H | — |
Publisher product statements
Version ranges and default statuses as reported by each provider.
| Vendor | Product | Version status | Source |
|---|---|---|---|
| composer | composer | >= 2.3.0, < 2.9.6 (affected)>= 1.0.0, < 2.2.27 (affected) | GitHub_M · cna |
| Red Hat | Red Hat Hardened Images | 2.9.7-1.hum1 and later (unaffected · rpm)Default: affected | redhat-SADP · adp |
Weaknesses
3- CWE-78 CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
- CWE-20 CWE-20: Improper Input Validation
- CWE-78 Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
References
6- https://access.redhat.com/errata/RHSA-2026:8165
- https://access.redhat.com/security/cve/CVE-2026-40261
- RHBZ#2458841 https://bugzilla.redhat.com/show_bug.cgi?id=2458841
- https://github.com/composer/composer/releases/tag/2.9.6
- https://github.com/composer/composer/security/advisories/GHSA-gqw4-4w2p-838q
- https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-40261.json
Provider assertions
3GitHub_M · cna
Composer has Command Injection via Malicious Perforce Reference
redhat-SADP · adp
composer: command injection via malicious Perforce source reference/url
CISA-ADP · adp
CISA ADP Vulnrichment
Provenance
- Schema
- 5.2
- Searchable
- yes
- Content hash
- 6d6e564743e620d38ea4b9b6999204b8f5149543270b653c4208d556385fd6d4
- Ingested
- 23 Sep 2026, 09:13:02 UTC
- Source record
- Official CVE record