Quick answers
- Is CVE-2026-40261 exploited in the wild?
- No. Junglewise Threat Intelligence has no report of CVE-2026-40261 being exploited in the wild.
- How severe is CVE-2026-40261?
- High severity, with a CVSS score of 8.8, published 15 April 2026.
- Which products and versions are affected?
- Composer (Packagist) >= 1.0.0, < 2.2.27; >= 2.3.0, < 2.9.6, 1.0.0 - 2.2.26, 2.3.0 - 2.9.5; composer/composer (Packagist) ECOSYSTEM:introduced=2.3.0,fixed=2.9.6.
- Is there a fix for CVE-2026-40261?
- Yes. composer/composer (Packagist): upgrade to 2.9.6 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
- How is CVE-2026-40261 attacked?
- It is attacked over the network, in a software library.
- Am I affected by CVE-2026-40261?
- Check whether you run Composer (Packagist) or composer/composer (Packagist) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.
How to fix
- composer/composer (Packagist): upgrade to 2.9.6 or later
composer require composer/composer:^2.9.6
Technical details
Composer's Perforce implementation contains two command injection vectors. The `Perforce::syncCodeBase()` method fails to properly escape the `$sourceReference` parameter before appending it to a shell command. Additionally, the `Perforce::generateP4Command()` method interpolates user-supplied connection parameters (port, user, client) from the source URL field without neutralization. An attacker controlling a Composer repository can serve malicious metadata that triggers these injections during a `composer install` or `update` when `--prefer-source` is used. The vulnerability is exploitable regardless of whether the Perforce binary is actually present on the host system. Fixes are available in versions 2.2.27 and 2.9.6.
Affected products
- Composer composer/composer >= 1.0.0, < 2.2.27; >= 2.3.0, < 2.9.6
Identifiers
- CVE-2026-40261
- GHSA-gqw4-4w2p-838q
Timeline
- 2026-04-14: advisory: GitHub Advisory GHSA-gqw4-4w2p-838q published
- 2026-04-14: patched: Fixed in versions 2.2.27 and 2.9.6