BIT-composer-2026-40261: Composer has Command Injection via Malicious Perforce Reference
Composer, a PHP dependency manager, contains a command injection vulnerability in versions 1.0 through 2.2.26 and 2.3 through 2.9.5. The vulnerability exists in the Perforce::syncCodeBase() and Perforce::generateP4Command() methods, which improperly escape user-supplied parameters, allowing arbitrary command injection. This can be exploited via malicious package metadata from compromised or malicious Composer repositories when installing or updating dependencies from source. The issue is fixed in Composer 2.2.27 and 2.9.6. Workarounds include avoiding source installs by using --prefer-dist or trusted repositories.
AI Analysis
Technical Summary
Composer versions >=1.0.0 <2.2.27 and >=2.3.0 <2.9.6 have a command injection vulnerability in the Perforce integration methods. The Perforce::syncCodeBase() method appends the $sourceReference parameter directly to shell commands without proper escaping, and Perforce::generateP4Command() interpolates user-supplied Perforce connection parameters from the source URL without escaping. This allows an attacker to inject arbitrary shell commands via crafted source reference or URL values in package metadata. Because package metadata can come from any Composer repository, a compromised or malicious repository can serve malicious metadata to trigger this vulnerability during dependency installation or updates from source, including default behavior for dev-prefixed versions. The vulnerability is fixed in Composer 2.2.27 (LTS) and 2.9.6 (mainline).
Potential Impact
An attacker controlling or compromising a Composer repository can execute arbitrary shell commands on a developer's system during dependency installation or update processes that involve source installs. This can lead to remote code execution on the developer's machine. The vulnerability affects all users installing or updating dependencies from source with affected Composer versions. It does not require Perforce to be installed on the target system. There are no known exploits in the wild at this time.
Mitigation Recommendations
A fix is available in Composer versions 2.2.27 and 2.9.6. Users should upgrade to these versions or later. If immediate upgrade is not possible, users can mitigate risk by avoiding installing dependencies from source using the --prefer-dist option or setting preferred-install to dist in Composer configuration. Additionally, only trusted Composer repositories should be used to prevent malicious package metadata injection.
BIT-composer-2026-40261: Composer has Command Injection via Malicious Perforce Reference
Description
Composer, a PHP dependency manager, contains a command injection vulnerability in versions 1.0 through 2.2.26 and 2.3 through 2.9.5. The vulnerability exists in the Perforce::syncCodeBase() and Perforce::generateP4Command() methods, which improperly escape user-supplied parameters, allowing arbitrary command injection. This can be exploited via malicious package metadata from compromised or malicious Composer repositories when installing or updating dependencies from source. The issue is fixed in Composer 2.2.27 and 2.9.6. Workarounds include avoiding source installs by using --prefer-dist or trusted repositories.
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
Composer versions >=1.0.0 <2.2.27 and >=2.3.0 <2.9.6 have a command injection vulnerability in the Perforce integration methods. The Perforce::syncCodeBase() method appends the $sourceReference parameter directly to shell commands without proper escaping, and Perforce::generateP4Command() interpolates user-supplied Perforce connection parameters from the source URL without escaping. This allows an attacker to inject arbitrary shell commands via crafted source reference or URL values in package metadata. Because package metadata can come from any Composer repository, a compromised or malicious repository can serve malicious metadata to trigger this vulnerability during dependency installation or updates from source, including default behavior for dev-prefixed versions. The vulnerability is fixed in Composer 2.2.27 (LTS) and 2.9.6 (mainline).
Potential Impact
An attacker controlling or compromising a Composer repository can execute arbitrary shell commands on a developer's system during dependency installation or update processes that involve source installs. This can lead to remote code execution on the developer's machine. The vulnerability affects all users installing or updating dependencies from source with affected Composer versions. It does not require Perforce to be installed on the target system. There are no known exploits in the wild at this time.
Mitigation Recommendations
A fix is available in Composer versions 2.2.27 and 2.9.6. Users should upgrade to these versions or later. If immediate upgrade is not possible, users can mitigate risk by avoiding installing dependencies from source using the --prefer-dist option or setting preferred-install to dist in Composer configuration. Additionally, only trusted Composer repositories should be used to prevent malicious package metadata injection.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- BIT-composer-2026-40261
- Osv Schema Version
- 1.6.2
- Aliases
- ["CVE-2026-40261"]
- Ecosystems
- ["Bitnami"]
- Database Specific Severity
- High
- Cvss Version
- null
Threat ID: 6a4c348127e9c79719606e23
Added to database: 07/06/2026, 23:04:33 UTC
Last enriched: 07/06/2026, 23:06:26 UTC
Last updated: 07/06/2026, 23:06:26 UTC
Views: 2
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.