← Vulnerability feed

Vulnerability record · CVE-2026-40261 · published 15 April 2026

CVE-2026-40261: Getcomposer composer improper input validation vulnerability

Getcomposer · Composer

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::syncCodeBase() method, which appends the $sourceReference parameter to a shell command without proper escaping, and additionally in the Perforce::generateP4Command() method as in GHSA-wg36-wvj6-r67p / CVE-2026-40176, which interpolates user-supplied Perforce connection parameters (port, user, client) from the source url field without proper escaping. An attacker can inject arbitrary commands through crafted source reference or source url values containing shell metacharacters, even if Perforce is not installed. Unlike CVE-2026-40176, the source reference and url are provided as part of package metadata, meaning any compromised or malicious Composer repository can serve package metadata declaring perforce as a source type with malicious values. This vulnerability is exploitable when installing or updating dependencies from source, including the default behavior when installing dev-prefixed versions. This issue has been fixed in Composer 2.2.27 (2.2 LTS) and 2.9.6 (mainline). If developers are unable to immediately update, they can avoid installing dependencies from source by using --prefer-dist or the preferred-install: dist config setting, and only use trusted Composer repositories as a workaround.

8.8 CVSS 3.1 High EPSS 1.9% · top 21.1% CWE-20 · Improper input validationCWE-78 · OS command injection
8.8CVSS 3.1 base score
1.9%EPSS exploitation probability, 30 days
NoNot in CISA KEV
1Affected product versions listed by NVD
6References
15 Jul 2026Last modified by NVD

Description

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::syncCodeBase() method, which appends the $sourceReference parameter to a shell command without proper escaping, and additionally in the Perforce::generateP4Command() method as in GHSA-wg36-wvj6-r67p / CVE-2026-40176, which interpolates user-supplied Perforce connection parameters (port, user, client) from the source url field without proper escaping. An attacker can inject arbitrary commands through crafted source reference or source url values containing shell metacharacters, even if Perforce is not installed. Unlike CVE-2026-40176, the source reference and url are provided as part of package metadata, meaning any compromised or malicious Composer repository can serve package metadata declaring perforce as a source type with malicious values. This vulnerability is exploitable when installing or updating dependencies from source, including the default behavior when installing dev-prefixed versions. This issue has been fixed in Composer 2.2.27 (2.2 LTS) and 2.9.6 (mainline). If developers are unable to immediately update, they can avoid installing dependencies from source by using --prefer-dist or the preferred-install: dist config setting, and only use trusted Composer repositories as a workaround.

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

Affected products

1 vulnerable configurations from NVD's CPE data, grouped by vendor and product.

References

Track CVE-2026-40261 inside VULONE

Watch it alongside the ransomware crews, C2 infrastructure and forum chatter that reference it, query it through the API and pull it into your SIEM over TAXII.

Start free Open in platform

Related vulnerabilities

Same products first, then exploited flaws of the same weakness class.

9.8CVE-2021-41116Getcomposer composer command injection vulnerabilityComposer is an open source dependency manager for the PHP language. In affected versions windows users running Composer to install untrusted dependen…EPSS 2.9%8.8CVE-2023-43655Getcomposer composer injection vulnerabilityComposer is a dependency manager for PHP. Users publishing a composer.phar to a public web-accessible server where the composer.phar can be executed …EPSS 1.4%8.8CVE-2015-8371Getcomposer composer insufficient verification of data authenticity vulnerabilityComposer before 2016-02-10 allows cache poisoning from other projects built on the same host. This results in attacker-controlled code entering a ser…EPSS 0.70%8.8CVE-2022-24828Getcomposer composer improper input validation vulnerabilityComposer is a dependency manager for the PHP programming language. Integrators using Composer code to call `VcsDriver::getFileContent` can have a cod…EPSS 1.9%8.8CVE-2021-29472Getcomposer composer argument injection vulnerabilityComposer is a dependency manager for PHP. URLs for Mercurial repositories in the root composer.json and package source download URLs are not sanitize…EPSS 4.6%7.8CVE-2026-40176Getcomposer composer improper input validation vulnerabilityComposer 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…EPSS 1.00%7.8CVE-2024-24821Getcomposer composer inclusion from untrusted sphere vulnerabilityComposer is a dependency Manager for the PHP language. In affected versions several files within the local working directory are included during the …EPSS 0.28%1.3CVE-2025-67746Getcomposer composer injection vulnerabilityComposer is a dependency manager for PHP. In versions on the 2.x branch prior to 2.2.26 and 2.9.3, attackers controlling remote sources that Composer…EPSS 0.45%

Source: NIST National Vulnerability Database (record CVE-2026-40261), CISA KEV, FIRST EPSS (scores of 2026-09-26). This page is refreshed as NVD updates the record.