LiveActive security incident?Get immediate response
CVE Record

CVE-2026-40176: 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).

HighCVSS 7.8Not KEV-listedUpdated
Glexia's TakeAutomated analysishigh

Security readout for executives and security teams

Plain-English summary

Composer can be tricked into running operating-system commands when someone runs Composer on an untrusted PHP project with a malicious root composer.json. The attacker must influence that project file or Composer config. This is serious for developer workstations and CI systems because code could execute with the privileges of the Composer process.

Executive priority

Treat as high priority for engineering and CI environments that process external code. Patch Composer in build images and developer baselines promptly, then tighten review of untrusted project manifests before dependency installation.

Technical view

The flaw is command injection in Composer's Perforce::generateP4Command(), where Perforce connection parameters are interpolated into shell commands without proper escaping. A malicious Perforce VCS repository entry in root composer.json or Composer config can trigger command execution, even without Perforce installed. Dependency package composer.json files are not an exploitation path.

Likely exposure

Exposure is most likely in developer machines, build runners, and CI pipelines that run vulnerable Composer versions against untrusted or newly submitted projects. Composer versions 1.0 through before 2.2.27 and 2.3 through before 2.9.6 are affected.

Exploitation context

Sources do not show CISA KEV listing or confirmed active exploitation. Exploitation requires user interaction: running Composer commands on attacker-supplied project content or compromised Composer configuration. The root composer.json and Composer config directory are the relevant trust boundaries.

Researcher notes

The important boundary is root project configuration, not transitive dependency manifests. Validation should focus on vulnerable Composer versions and whether untrusted composer.json or Composer config content can reach automated build systems. No source in the bundle establishes public exploitation in the wild.

Mitigation direction

  • Upgrade Composer 2.2 LTS to 2.2.27 or later.
  • Upgrade Composer mainline to 2.9.6 or later.
  • Avoid running Composer on untrusted projects before review.
  • Inspect root composer.json and Composer config for Perforce VCS repositories.
  • Update distribution packages using vendor guidance, including Red Hat advisories where applicable.

Validation and detection

  • Inventory Composer versions on developer workstations and CI images.
  • Confirm versions are 2.2.27, 2.9.6, or later as appropriate.
  • Review project root composer.json files for Perforce VCS repository entries.
  • Review Composer config directories used by build environments.
  • Check vendor package status if Composer is supplied by an operating-system distribution.
Prepared
Confidence
high
Sources
8

Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.

Potential ATT&CK relevance

Conservative CVE-to-ATT&CK context

These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.

ATT&CK lookup starting points

Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.

cwe · low confidence lookup

CWE-20: Exact CWE lookup

Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.

Open ATT&CK lookup
cwe · medium confidence lookup

CWE-78: Command execution behavior lookup

Command injection weaknesses can lead defenders to review execution techniques and command interpreter telemetry. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.

Open ATT&CK lookup
description · low confidence lookup

Execution behavior lookup

The CVE wording references code or command execution, so execution technique review may help defensive triage. This is a Glexia inferred lookup path, not an official MITRE, ATT&CK, or CVE Program mapping.

Open ATT&CK lookup
cve · low confidence lookup

CVE-2026-40176 mapping review

Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.

Open ATT&CK lookup
Vulnerability profileCVE Program record
Severity
High
CVSS
7.8 (3.1)
Known Exploited
No
Published

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

Official CVE source material

CNA and ADP enrichment extracted from CVE v5

These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.

2CVSS vectors
5Timeline events
2ADP providers
7Source links

SSVC decision data

CISA-ADPCISA Coordinator
Timestamp
Version
2.0.3
Exploitation: noneAutomatable: noTechnical Impact: total

CVSS vector scores

2 official scores

We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.

ScoreVersionSeverityVectorExploitImpactSource
7.8CVSS 3.1HighCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H1.85.9GitHub_M
7.8CVSS 3.1HighCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H1.85.9redhat-SADP

Vulnerability scoring details

Base CVSS 3.1 score

7.8High
CVSS 3.1 vector shape for CVE-2026-40176Attack VectorAttack ComplexityPrivileges RequiredUser InteractionScopeConfidentiality ImpactIntegrity ImpactAvailability Impact

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

Attack Vector
NetworkAdjacentLocalPhysical
Attack Complexity
LowHigh
Privileges Required
NoneLowHigh
User Interaction
NoneRequired
Scope
ChangedUnchanged
Confidentiality Impact
HighLowNone
Integrity Impact
HighLowNone
Availability Impact
HighLowNone

Vulnerability timeline

Timeline events are normalized from CVE metadata, CNA source timelines, ADP timelines, and KEV metadata when present.

  1. CVE reservedCVE Program

    The CVE ID was reserved by the assigning CNA.

  2. ADP timelineredhat-SADP

    Made public.

  3. CVE publishedCVE Program

    The CVE record was published.

  4. ADP timelineredhat-SADP

    Reported to Red Hat.

  5. CVE updatedCVE Program

    The CVE record metadata indicates this as the latest update time.

ADP provider summaries

CISA-ADPCISA ADP Vulnrichment
other:ssvc
redhat-SADPcomposer: command injection via malicious Perforce repository definition
other:Red Hat severity ratingcvssV3_1
  • 2026-04-15T21:00:48.175Z: Reported to Red Hat.
  • 2026-04-15T20:47:39.839Z: Made public.

Source materials

Affected products

Products and packages named in the record

VendorProductVersion / packageStatus
composercomposer>= 2.3, < 2.9.6, >= 1.0, < 2.2.27Listed
Weakness

CWE details

CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.