Skip to main content
Mallory
HighPublic exploitVulnerability

CVE-2026-40176: Command Injection in Composer Perforce Command Generation

Published Apr 15, 2026 · Updated 21 days ago
Trending this weekNot trendingOutside this week’s top 100
Mention activity · 30 daysNo mention activity in the last 30 days.
CVSS7.8High · v3.1
EPSS1.1%65th percentile
CISA KEVNoNot listed
In the wildNonePublic exploit, no exploitation reported
Vendor
Getcomposer
IdentifiersCVE-2026-40176CWE-78 · Improper Neutralization of Special…

CVE-2026-40176 is an OS command injection vulnerability in Composer, the PHP dependency manager, affecting versions 1.0 through 2.2.26 and 2.3 through 2.9.5. The Perforce::generateP4Command() method interpolates attacker-controlled Perforce port, user, and client parameters into shell commands without proper escaping. A malicious Perforce VCS repository configuration in a root project or the Composer configuration directory can trigger arbitrary command execution when a user runs Composer. Exploitation does not require Perforce to be installed. Repository declarations in installed dependencies' manifests do not trigger this vulnerability.

Do you run this?See affected versions in your environment and whether adversaries are exploiting this vulnerability against assets like yours.
Check your exposure
Analyst brief

Impact, mitigation & remediation

What it means and what to do now: patch path, interim mitigations, and the assume-compromise checklist.

Impact

What an attacker gets, and what they’ve been doing with it.

Successful exploitation permits arbitrary shell command execution with the privileges of the user running Composer. This can compromise the confidentiality and integrity of accessible project data, credentials, and other resources, and affect system availability. Execution in a privileged development or build environment extends the impact to resources accessible to that account.

Mitigation

If you can’t patch tonight, do this now.

Run Composer only on projects from trusted sources. Before processing an untrusted project, inspect its root composer.json for Perforce repository declarations and validate the port, user, and client values. Also review repository declarations in the Composer configuration directory and remove untrusted configurations.

Remediation

Patch, then assume compromise.

Upgrade Composer to version 2.2.27 on the 2.2 LTS branch, version 2.9.6 on the mainline branch, or a later fixed release.

Public exploits

Exploits

4 exploits validated by Mallory's analysis.

View more in app →
composer-CVE-2026-40261-CVE-2026-40176-PoCThis repository is a small proof-of-concept set for command injection in Composer's Perforce VCS driver. It contains one README and three JSON files: a default composer.json plus two variant PoCs, composer.json.vector1 and composer.json.vector2. The exploit is not part of a larger framework. The core capability is arbitrary shell command execution when Composer parses a crafted perforce repository definition during operations such as 'composer install --prefer-dist'. The repository demonstrates two concrete injection vectors: (1) the perforce repository 'url' field, which is interpreted as the Perforce server/port argument and is populated with 'localhost:1666; touch /tmp/pwned_via_port'; and (2) the 'p4user' field, populated with 'user; touch /tmp/pwned_via_user #'. In both cases, shell metacharacters break out of the intended argument context and append a shell command. The README explains how to reproduce the issue in a Docker container using a vulnerable Composer image, verify absence of the marker file in /tmp, run 'composer install --prefer-dist', and then confirm successful execution by observing the created file. The exploit is operational but simple: it uses hardcoded shell commands as payloads rather than a customizable framework. There is no detection-only logic; the repository is intended to trigger exploitation directly.terminat0r7031 · Disclosed Apr 16, 2026 · json · markdown · local · fileOperationalCVE-2026-40176-pocThis repository is a small standalone PHP proof-of-concept for CVE-2026-40176, an OS command injection issue in Composer's Perforce VCS driver. The repo contains three files: a README describing the vulnerability and usage, a malicious sample `composer.json`, and `poc.php`, which reproduces the vulnerable command-building logic. The exploit does not target a remote service directly; instead, it abuses attacker-controlled repository metadata that would be processed by a victim running vulnerable Composer versions. In `poc.php`, the `VulnerablePerforce` class mimics Composer's `generateP4Command()` behavior by concatenating unescaped user-controlled values into a shell command. The PoC sets the Perforce port to `localhost:1666; touch /tmp/pwned_rce_confirmed #`, generates a command like `p4 -u user -p localhost:1666; touch /tmp/pwned_rce_confirmed # login -s`, and executes it with `system()`. Successful exploitation is confirmed by checking for `/tmp/pwned_rce_confirmed`, then removing it. Overall, the repository's purpose is to demonstrate arbitrary command execution resulting from unsafe shell command construction in vulnerable Composer versions when processing malicious Perforce repository configuration.Saku0512 · Disclosed Apr 16, 2026 · markdown · json · web · file · localOperationalcve-2026-40176-cve-2026-40261Small PoC repository for an alleged Composer Perforce repository command-injection vulnerability identified as CVE-2026-40176. The repository contains only two files: a README describing the issue and reproduction steps, and a crafted composer.json that acts as the exploit artifact. There is no standalone exploit program; the exploit is triggered by running vulnerable Composer against the malicious project configuration. Core capability: the composer.json defines a repository of type 'perforce' with attacker-controlled fields. The p4user field contains the payload 'user; touch ./pwned #', intended to break out of the generated shell command and execute an arbitrary local shell command. If Composer versions prior to 2.2.27 construct Perforce CLI commands without proper escaping, running 'composer install' or 'composer update' would execute the injected command. Repository structure and purpose: README.md documents the claimed vulnerability, affected versions, vulnerable code pattern, and mitigation guidance. composer.json is the actual PoC configuration and the main entry point. The README mentions additional files (vuln-composer.phar and patched-composer.phar), but they are not present in the analyzed repository snapshot, so the repo is incomplete relative to its documentation. Notable findings: the PoC targets the local machine executing Composer rather than a remote network service directly; the attack vector is best characterized as supply-chain/configuration-driven leading to local command execution during dependency resolution. The included endpoint 'localhost:8080' is the configured Perforce server target. There is a documentation inconsistency: the README says exploitation should create '/tmp/pwned', while the actual payload in composer.json creates './pwned'. Overall, this is a plausible operational PoC configuration rather than a full exploit toolkit.daptheHuman · Disclosed Apr 17, 2026 · json · markdown · supply_chain · localOperationalCVE-2026-40176This repository is a self-contained PHP proof-of-concept for CVE-2026-40176, a command-injection issue in Composer's Perforce repository driver. The main exploit logic is in CVE202640176Test.php, which implements an object-oriented differential test: it runs the same malicious composer.json against Composer 2.9.5 (claimed vulnerable) and Composer 2.9.6 (claimed fixed), then compares outcomes. The exploit capability is local arbitrary command execution triggered when a victim runs 'composer update' on an attacker-controlled manifest containing a crafted repositories entry of type 'perforce'. The exploit works by generating a malicious p4:// URL with shell metacharacters embedded in the user/URL portion: it appends ';touch <marker> && echo <runId> > <marker>' so that when Composer constructs the underlying p4 command, the shell executes the injected commands. Successful exploitation is validated by three checks: parsing the Composer version from output, confirming the marker file exists with the expected run ID, and confirming output contains 'p4' to indicate the Perforce driver path was reached. Repository structure is small and focused: the PHP PoC file, a base composer.json used as a template, a Dockerfile that builds a reproducible lab with pinned Composer PHARs, a docker-compose.yml that can run the PoC and optionally start a Helix Core/Perforce server, plus a README documenting the vulnerability and usage. The Docker setup is primarily for reproducibility and containment; the PoC does not require a live Perforce server because the injected command is intended to fire while Composer builds/invokes the p4 command path. Overall, this is a real exploit PoC rather than a mere detector: it actively attempts command execution and demonstrates a benign side effect as proof.ikarolaborda · Disclosed Jun 15, 2026 · php · dockerfile · local · fileOperational
Exposure surface

Affected products & vendors

Products and vendors Mallory has correlated with this vulnerability. Open in Mallory to drill down to specific CPE configurations and version ranges.

VendorProductType
GetcomposerComposerapplication
FAQ

Frequently asked questions

Is CVE-2026-40176 exploited in the wild?
As of Nov 3, 2026, Mallory has no reports of CVE-2026-40176 being exploited in the wild. It is not listed in CISA KEV.
Is there a public exploit for CVE-2026-40176?
Yes. Mallory tracks 4 public exploits or proofs of concept for CVE-2026-40176, the earliest disclosed Apr 16, 2026.
Is there a patch for CVE-2026-40176?
Upgrade Composer to version 2.2.27 on the 2.2 LTS branch, version 2.9.6 on the mainline branch, or a later fixed release.
What products are affected by CVE-2026-40176?
Getcomposer Composer.
How severe is CVE-2026-40176?
CVE-2026-40176 has a CVSS v3.1 score of 7.8 (High) and an EPSS score of 1.1% (65th percentile) as of Nov 3, 2026.
Activity feed

Recent activity

19 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.

View more in app →
+2 more in the timeline. Sign up to see them
Do you run this?See affected versions in your environment and whether adversaries are exploiting this vulnerability against assets like yours.
Check your exposure
Mallory platform

The version that knows your environment.

This page is what’s public. Mallory adds the parts that aren’t: which of your assets are affected, which adversaries are exploiting it right now, and which detections to deploy tonight.
Exposure mappingQuery your assets running an affected version, and investigate the blast radius.
Threat actor evidenceEvery report linking this CVE to a named adversary.
Associated malwareMalware families linked to this CVE, with evidence and IOCs.
Detection signaturesYARA, Sigma, Snort, and vendor rules, auto-deployed to your SIEM.
Vendor-by-vendor mappingCross-references every affected SKU, including bundled OEM variants.
Social activity12Community discussion across Reddit, Mastodon, and other social sources.