Command injectionin composer.
Proof of concept public (GitHub).
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::generateP4Command() method, which constructs shell commands by interpolating user-supplied Perforce connection parameters (port, user, client) without proper escaping. An attacker can inject arbitrary commands through these values in a malicious composer.json declaring a Perforce VCS repository, leading to command execution in the context of the user running Composer, even if Perforce is not installed. VCS repositories are only loaded from the root composer.json or the composer config directory, so this cannot be exploited through composer.json files of packages installed as dependencies.
- Upgrade composer to 2.2.27, 2.9.6 or later, whichever matches your release line.
- Upgrade composer/composer (Packagist) to 2.2.27, 2.9.6 or later, whichever matches your release line.
Affected and fixed versions
From the CVE record, NVD and package advisories. When no source has versions yet, this table says "not confirmed" instead of guessing.
From first report to first attacks
- 9 Apr 2026CVE ID reserved by GitHub_M.
- 15 Apr 2026Published in the CVE List.
- 16 Apr 2026First public proof of concept on GitHub.
- 2 Nov 2026CVE record last updated.
Attack code anyone can find
Exploit maturity: Proof of concept (GitHub). CISA assessment (SSVC): exploitation none.
Listed so defenders can judge how urgent this is and test systems they are authorised to test. Patchminder does not host exploit code; links open the source page. Labels for GitHub repositories come from their public details and are never a promise about the code. Run anything only in an isolated lab.
Report a link
Other composer vulnerabilities
Same weakness: Improper input validation
- github.com x_refsource_CONFIRM
- access.redhat.com x_refsource_MISC
- access.redhat.com x_refsource_MISC
- bugzilla.redhat.com x_refsource_MISC
- github.com x_refsource_MISC
- github.com x_refsource_MISC
- github.com x_refsource_MISC
- security.access.redhat.com x_refsource_MISC
Patchminder. CVE-2026-40176: Command injection in composer. https://patchminder.com/cve/cve-2026-40176/ (accessed 5 December 2026).