PoC Monitor
← All CVEs
CVE-2026-40176published 15 Apr 2026 20:47 UTCData: JSON · API

Composer

Composer is vulnerable to Command Injection via Malicious Perforce Repository

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. Users are at risk if they run Composer commands on untrusted projects with attacker-supplied composer.json files. This issue has been fixed in Composer 2.2.27 (2.2 LTS) and 2.9.6 (mainline).

First public PoC 8 hafter publication · 16 Apr 2026
Public PoCs22 on GitHub
CVSS7.8high · scored by CNA · CWE-20
CISA KEV Not listednot known exploited

Affected versions and mitigation

From the CVE record and the vendor's references.

Affected

composer composer
  • >= 2.3, < 2.9.6
  • >= 1.0, < 2.2.27

Fixed in 2.9.6, 2.2.27

Mitigation

Upgrade composer to 2.9.6 or 2.2.27 or later.

References

Timeline

Days relative to CVE publication
-2t=0+2+4+6+8CVE published15 Apr 2026 · t = 0First public PoC16 Apr 2026 · t+8h

First public PoC 8 h after publication; not in CISA KEV. First PoC: Saku0512/CVE-2026-40176-poc (created 16 Apr 2026, found by us: backfilled).

PoC repositories

Found on GitHub.

2 PoCs · 2 informational

PoCs 2
RepositoryCreatedStarsAssessment
Saku0512/CVE-2026-40176-poc 16 Apr 2026 +8 h 2 PoC
ikarolaborda/CVE-2026-40176 15 Jun 2026 +61 d 0 PoC
Informational 2
RepositoryCreatedStarsAssessment
terminat0r7031/composer-CVE-2026-40261-CVE-2026-40176-PoC 16 Apr 2026 +7 h 2 Informational · write-up
daptheHuman/cve-2026-40176-cve-2026-40261 17 Apr 2026 +1.4 d 0 Informational · write-up

Only PoCs count toward the first-PoC date and the characteristics below. Do not run PoC code from unknown sources.

PoC characteristics

What to hunt for in your logs · from 2 PoC repos

GET /usr/local/bin/composer-2.9.5.phar

Seen in
1 repo: ikarolaborda/CVE-2026-40176
Evidence
ikarolaborda/CVE-2026-40176/README.md:143

GET /usr/local/bin/composer-2.9.6.phar

Seen in
1 repo: ikarolaborda/CVE-2026-40176
Evidence
ikarolaborda/CVE-2026-40176/README.md:144

Regex

Generated from PoC characteristics; not yet reviewed. Matches the request path and query.

GET /usr/local/bin/composer-2.9.5.phar
(?i)^/usr/local/bin/composer-2\.9\.5\.phar(?:[?#].*)?$
GET /usr/local/bin/composer-2.9.6.phar
(?i)^/usr/local/bin/composer-2\.9\.6\.phar(?:[?#].*)?$

Suricata

Template generated from PoC characteristics. Review before deploying.

GET /usr/local/bin/composer-2.9.5.phar
alert http any any -> $HOME_NET any (msg:"GG PoC-Monitor CVE-2026-40176 composer composer exploit attempt"; flow:established,to_server; http.method; content:"GET"; http.uri; content:"/usr/local/bin/composer-2.9.5.phar"; reference:url,poc.griffinguard.io/cve/CVE-2026-40176; classtype:web-application-attack; sid:9614967; rev:1;)
GET /usr/local/bin/composer-2.9.6.phar
alert http any any -> $HOME_NET any (msg:"GG PoC-Monitor CVE-2026-40176 composer composer exploit attempt"; flow:established,to_server; http.method; content:"GET"; http.uri; content:"/usr/local/bin/composer-2.9.6.phar"; reference:url,poc.griffinguard.io/cve/CVE-2026-40176; classtype:web-application-attack; sid:9022756; rev:1;)

Sigma

Template generated from PoC characteristics. Review before deploying.

GET /usr/local/bin/composer-2.9.5.phar
title: composer composer exploit attempt (CVE-2026-40176)
id: gg-pocmon-cve-2026-40176-9614967
status: experimental
description: Request pattern taken from public PoCs for CVE-2026-40176. Generated, not reviewed.
references:
  - https://poc.griffinguard.io/cve/CVE-2026-40176
logsource:
  category: webserver
detection:
  selection:
    cs-method: GET
    cs-uri-stem|contains|all:
      - '/usr/local/bin/composer-2.9.5.phar'
  condition: selection
falsepositives:
  - Authorized vulnerability scanning
level: high
tags:
  - attack.initial_access
  - attack.t1190
  - cve.2026.40176
GET /usr/local/bin/composer-2.9.6.phar
title: composer composer exploit attempt (CVE-2026-40176)
id: gg-pocmon-cve-2026-40176-9022756
status: experimental
description: Request pattern taken from public PoCs for CVE-2026-40176. Generated, not reviewed.
references:
  - https://poc.griffinguard.io/cve/CVE-2026-40176
logsource:
  category: webserver
detection:
  selection:
    cs-method: GET
    cs-uri-stem|contains|all:
      - '/usr/local/bin/composer-2.9.6.phar'
  condition: selection
falsepositives:
  - Authorized vulnerability scanning
level: high
tags:
  - attack.initial_access
  - attack.t1190
  - cve.2026.40176