Skip to content

← Actionable
High, CVSS 8.8

Composer has a command injection via malicious perforce reference

CVE-2026-40261GHSA-gqw4-4w2p-838q

What to do

Vendor fix available. Upgrade each affected package to the fixed version on its release line (composer/composer 2.9.6, 2.2.27), redeploy, then verify what is actually installed.

This page has no inventory attached, so it cannot say whether you are affected. A vendor fix is not proof that your deployment is fixed.

Affected packages

  • Packagist composer/composer

    Affected
    >= 2.3.0, < 2.9.6>= 1.0.0, < 2.2.27
    Fixed in
    2.9.6, 2.2.27

Sources

Severity and exploitation
Exploitation
No confirmed exploitation recorded. Patch Next marks exploitation only from CISA KEV.
CVSS
8.8 · CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
EPSS
  • CVE-2026-40261: 1.69% estimated exploitation activity in the next 30 days; percentile 77.07 (FIRST EPSS, 2026-11-03). This is a model estimate, not proof of exploitation or customer exposure.
Source description

As published by the source; long descriptions are shortened.

Impact The Perforce::syncCodeBase() method appended the $sourceReference parameter to a shell command without proper escaping, allowing an attacker to inject arbitrary commands through a crafted source reference containing shell metacharacters. Further as in GHSA-wg36-wvj6-r67p / CVE-2026-40176 the Perforce::generateP4Command() method constructed shell commands by interpolating user-supplied Perforce connection parameters (port, user, client) without proper escaping from the source url field. Composer would execute these injected commands even if Perforce is not installed. The source reference and url are provided as part of package metadata. Any Composer package repository can serve package metadata declaring perforce as a source type with a malicious source reference or source url. This means the vulnerability can be exploited through any package served by a compromised or malicious Composer repository. An attack does not require Perforce to be installed on the client, as Composer…

Dates and revisions
Published by the source
Last modified by the source
Source last checked
  1. Revision 1 · created ·

    Published from ghsa record GHSA-gqw4-4w2p-838q

Agent brief

Preview the exact text before you copy it. Commands are read-only suggestions; review them before running anything.

# Patch Next advisory brief: CVE-2026-40261

Advisory: Composer has a command injection via malicious perforce reference
IDs: CVE-2026-40261, GHSA-gqw4-4w2p-838q
Record: https://patchnext.com/advisories/cve-2026-40261 (revision 1, source checked 26 Oct 2026, 14:50 UTC)
Inventory: none attached. This brief comes from a public page and does not say whether any deployment is affected.
Severity: High (CVSS 8.8)
Exploitation: no confirmed exploitation recorded. Patch Next confirms exploitation only from CISA KEV.
Vendor response: Vendor fix available; fixed versions by package: composer/composer 2.9.6, 2.2.27. A vendor fix does not mean a deployment is fixed.

## Affected components
- Packagist composer/composer: affected >= 2.3.0, < 2.9.6; >= 1.0.0, < 2.2.27; fixed in 2.9.6, 2.2.27

## Suggested inspection (read-only)
- Packagist composer/composer: check the installed version with your package manager.

## Supported action
Upgrade each affected component to a fixed version on its release line. For a transitive dependency, upgrade the parent package or add an override or constraint, then regenerate the lockfile. Redeploy every environment that ran an affected version.

## Required regression checks
- Run the test suite and a production build.
- Exercise the features that depend on composer/composer.
- Repeat the inspection and confirm that only fixed versions remain installed.

## Rollback considerations
- Keep the previous lockfile and deployment artifact. Rolling back reinstates the vulnerable version, so apply any documented mitigation while you fix forward.

## Unresolved questions
- Which deployments run an affected version?
- Exploitation status can change. Check again before lowering the priority.
- Mark the work resolved only after the fixed version is verified in production.

## Sources
- Verified: https://github.com/advisories/GHSA-gqw4-4w2p-838q (GitHub-reviewed advisory GHSA-gqw4-4w2p-838q lists affected ranges: Packagist composer/composer >=2.3.0 =1.0.0 <2.2.27)

Commands are suggestions: review each one before running it.

Loading voting…