Skip to content

← Actionable
High, CVSS 7.8amended

Composer has a command injection via malicious perforce repository

CVE-2026-40176GHSA-wg36-wvj6-r67p

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
7.8 · CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
EPSS
  • CVE-2026-40176: 1.04% estimated exploitation activity in the next 30 days; percentile 64.19 (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::generateP4Command()` method constructed shell commands by interpolating user-supplied Perforce connection parameters (port, user, client) without proper escaping. An attacker controlling a repository configuration in a malicious composer.json declaring a Perforce VCS repository could inject arbitrary commands through these values, leading to command execution in the context of the user running Composer. Composer would execute these injected commands even if Perforce is not installed. VCS repositories are only loaded from the root composer.json file located in the directory you execute Composer commands in and from the composer config directory (e.g. `~/.config/composer/composer.json`). So this vulnerability cannot be exploited through composer.json files of packages installed as dependencies. You are at risk of command execution if you run Composer commands on untrusted projects with attacker supplied composer.json files, regardless of whether you or any of…

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

    Amended from osv record GHSA-wg36-wvj6-r67p

  2. Revision 2 · amended ·

    Amended from ghsa record GHSA-wg36-wvj6-r67p

  3. Revision 1 · created ·

    Published from ghsa record GHSA-wg36-wvj6-r67p

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-40176

Advisory: Composer has a command injection via malicious perforce repository
IDs: CVE-2026-40176, GHSA-wg36-wvj6-r67p
Record: https://patchnext.com/advisories/cve-2026-40176 (revision 3, source checked 3 Nov 2026, 06:10 UTC)
Inventory: none attached. This brief comes from a public page and does not say whether any deployment is affected.
Severity: High (CVSS 7.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-wg36-wvj6-r67p (GitHub-reviewed advisory GHSA-wg36-wvj6-r67p lists affected ranges: Packagist composer/composer >=2.3.0 =1.0.0 <2.2.27)
- Verified: https://osv.dev/vulnerability/GHSA-wg36-wvj6-r67p (OSV record GHSA-wg36-wvj6-r67p lists affected ranges: Packagist composer/composer >=2.3.0 =1.0.0 <2.2.27 (fixed))

Commands are suggestions: review each one before running it.

Loading voting…