BIT-composer-2026-40176: Composer is vulnerable to Command Injection via Malicious Perforce Repository
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::generateP4Command() method, which improperly escapes user-supplied Perforce connection parameters. An attacker can exploit this by crafting a malicious composer.json file declaring a Perforce VCS repository, leading to arbitrary command execution with the privileges of the user running Composer. This issue cannot be exploited through composer.json files of dependencies, only from the root composer.json or composer config directory. The vulnerability is fixed in versions 2.2.27 and 2.9.6.
AI Analysis
Technical Summary
Composer versions >=1.0.0 <2.2.27 and >=2.3.0 <2.9.6 are vulnerable to command injection via the Perforce::generateP4Command() method. This method constructs shell commands by interpolating Perforce connection parameters (port, user, client) without proper escaping, allowing an attacker to inject arbitrary commands through a malicious composer.json file that declares a Perforce VCS repository. Exploitation requires running Composer commands on untrusted projects with attacker-controlled composer.json files. The vulnerability is resolved in Composer 2.2.27 and 2.9.6.
Potential Impact
Successful exploitation allows arbitrary command execution with the privileges of the user running Composer. This can lead to system compromise or unauthorized actions on the host. The vulnerability affects only users who run Composer on untrusted projects containing malicious composer.json files with Perforce VCS repository declarations. It does not affect composer.json files of installed dependencies.
Mitigation Recommendations
A fix is available in Composer versions 2.2.27 and 2.9.6. Users should upgrade to one of these versions or later to remediate this vulnerability. Avoid running Composer commands on untrusted projects or with untrusted composer.json files until patched.
BIT-composer-2026-40176: Composer is vulnerable to Command Injection via Malicious Perforce Repository
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::generateP4Command() method, which improperly escapes user-supplied Perforce connection parameters. An attacker can exploit this by crafting a malicious composer.json file declaring a Perforce VCS repository, leading to arbitrary command execution with the privileges of the user running Composer. This issue cannot be exploited through composer.json files of dependencies, only from the root composer.json or composer config directory. The vulnerability is fixed in versions 2.2.27 and 2.9.6.
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 are vulnerable to command injection via the Perforce::generateP4Command() method. This method constructs shell commands by interpolating Perforce connection parameters (port, user, client) without proper escaping, allowing an attacker to inject arbitrary commands through a malicious composer.json file that declares a Perforce VCS repository. Exploitation requires running Composer commands on untrusted projects with attacker-controlled composer.json files. The vulnerability is resolved in Composer 2.2.27 and 2.9.6.
Potential Impact
Successful exploitation allows arbitrary command execution with the privileges of the user running Composer. This can lead to system compromise or unauthorized actions on the host. The vulnerability affects only users who run Composer on untrusted projects containing malicious composer.json files with Perforce VCS repository declarations. It does not affect composer.json files of installed dependencies.
Mitigation Recommendations
A fix is available in Composer versions 2.2.27 and 2.9.6. Users should upgrade to one of these versions or later to remediate this vulnerability. Avoid running Composer commands on untrusted projects or with untrusted composer.json files until patched.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- BIT-composer-2026-40176
- Osv Schema Version
- 1.6.2
- Aliases
- ["CVE-2026-40176"]
- Ecosystems
- ["Bitnami"]
- Database Specific Severity
- High
- Cvss Version
- null
Threat ID: 6a4c348127e9c79719606e2c
Added to database: 07/06/2026, 23:04:33 UTC
Last enriched: 07/06/2026, 23:06:18 UTC
Last updated: 07/07/2026, 00:07:54 UTC
Views: 3
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.