Skip to main content
Mallory
HighPublic exploitVulnerability

CVE-2026-40261: Command Injection in Composer Perforce VCS Driver

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

CVE-2026-40261 is a command injection vulnerability in Composer's Perforce VCS driver. Affected versions are Composer 1.0 through 2.2.26 and 2.3 through 2.9.5. The flaw is centered on the Perforce::syncCodeBase() method, which appends the attacker-controlled $sourceReference value to a shell command without proper escaping. The issue is compounded by unsafe command construction in Perforce::generateP4Command(), similar to CVE-2026-40176, where Perforce connection parameters derived from the source URL may also be interpolated into shell commands without sufficient escaping. Unlike CVE-2026-40176, this vulnerability is delivered through package metadata from a malicious or compromised Composer repository: an attacker can publish or serve metadata declaring a Perforce source type and embed shell metacharacters in the source reference or source URL fields. When Composer installs or updates dependencies from source, the crafted metadata can cause arbitrary shell commands to be executed on the client system, even if Perforce itself is not installed.

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 results in arbitrary command execution in the security context of the user running Composer. This can allow compromise of developer workstations, CI runners, or build environments; theft of credentials, tokens, SSH keys, or source code; modification of project files or dependency trees; installation of persistence mechanisms or secondary payloads; and broader supply-chain compromise if the affected environment has access to internal repositories, signing material, or deployment infrastructure. The issue is particularly severe because exploitation can be triggered by malicious dependency metadata from a repository rather than requiring a user to manually open an untrusted root project.

Mitigation

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

If immediate patching is not possible, avoid installing dependencies from source by using --prefer-dist or setting preferred-install to dist. Restrict Composer usage to trusted repositories only, and avoid consuming package metadata from untrusted or compromised repository sources. Where feasible, disable or block Perforce-backed source installs in internal workflows, and monitor developer and CI environments for unexpected shell execution during Composer operations. Additional defensive measures include isolating build environments, minimizing available credentials on systems running Composer, and reviewing repository metadata handling in internal package mirrors.

Remediation

Patch, then assume compromise.

Upgrade Composer to a fixed release: 2.2.27 for the 2.2 LTS branch or 2.9.6 for the mainline branch. Organizations should update all developer endpoints, CI/CD agents, build containers, and any automation invoking Composer. If repository mirrors or internal package infrastructure cache Composer metadata, ensure they are refreshed after upgrading. Review recent installs or updates performed from source against untrusted or third-party repositories for signs of command execution or tampering.

Public exploits

Exploits

2 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-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 · localOperational
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-40261 exploited in the wild?
As of Sep 25, 2026, Mallory has no reports of CVE-2026-40261 being exploited in the wild. It is not listed in CISA KEV.
Is there a public exploit for CVE-2026-40261?
Yes. Mallory tracks 2 public exploits or proofs of concept for CVE-2026-40261, the earliest disclosed Apr 16, 2026.
Is there a patch for CVE-2026-40261?
Upgrade Composer to a fixed release: 2.2.27 for the 2.2 LTS branch or 2.9.6 for the mainline branch. Organizations should update all developer endpoints, CI/CD agents, build containers, and any automation invoking Composer.
What products are affected by CVE-2026-40261?
Getcomposer Composer.
How severe is CVE-2026-40261?
CVE-2026-40261 has a CVSS v3.1 score of 8.8 (High) and an EPSS score of 1.7% (78th percentile) as of Sep 25, 2026.
Activity feed

Recent activity

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

View more in app →
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 activity13Community discussion across Reddit, Mastodon, and other social sources.