LiveActive security incident?Get immediate response
CVE Record

CVE-2026-40261: Composer has Command Injection via Malicious Perforce Reference

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.

HighCVSS 8.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 during dependency install or update if a malicious or compromised repository supplies crafted Perforce package metadata. This is a build-chain risk for developer machines, CI, and release systems when Composer installs packages from source, including dev-prefixed versions.

Executive priority

Prioritize remediation for build and release environments first. Compromise there can affect source code integrity, secrets, and deployed artifacts. Treat this as a high-priority supply-chain issue, not only a developer workstation bug.

Technical view

Affected Composer versions append sourceReference in Perforce::syncCodeBase() and interpolate Perforce URL connection parameters in generateP4Command() without proper shell escaping. Malicious package metadata can inject commands through source reference or source URL values, even when Perforce is not installed.

Likely exposure

Exposure is most likely in PHP environments using Composer 1.0.0 to before 2.2.27, or 2.3.0 to before 2.9.6, especially CI and developer workflows using source installs, dev-prefixed dependencies, or non-trusted Composer repositories.

Exploitation context

The bundle does not report active exploitation, and KEV is false. Exploitation requires user interaction through installing or updating dependencies from source, with malicious metadata served by a compromised or malicious Composer repository.

Researcher notes

This issue extends the Perforce command-injection pattern associated with CVE-2026-40176 by allowing malicious package metadata to supply the source reference and URL. Evidence supports affected ranges and fixed Composer versions, but the bundle does not provide proof of public exploitation.

Mitigation direction

  • Upgrade Composer 2.2 LTS to 2.2.27 or later.
  • Upgrade Composer mainline to 2.9.6 or later.
  • Use preferred-install: dist where immediate upgrade is not possible.
  • Use --prefer-dist for dependency installation as a temporary workaround.
  • Restrict Composer repositories to trusted sources.

Validation and detection

  • Inventory Composer versions on developer machines, CI runners, and build images.
  • Check whether builds install dependencies from source or use dev-prefixed versions.
  • Review Composer repository configuration for untrusted or unnecessary repositories.
  • Confirm preferred-install is set to dist where upgrades are delayed.
  • Monitor vendor advisories for downstream package status and guidance.
Prepared
Confidence
high
Sources
6

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-40261 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
8.8 (3.1)
Known Exploited
No
Published

Vector: CVSS:3.1/AV:N/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
8.8CVSS 3.1HighCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H2.85.9GitHub_M
8.8CVSS 3.1HighCVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H2.85.9redhat-SADP

Vulnerability scoring details

Base CVSS 3.1 score

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

Vector: CVSS:3.1/AV:N/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 source reference/url
other:Red Hat severity ratingcvssV3_1
  • 2026-04-15T22:00:54.256Z: Reported to Red Hat.
  • 2026-04-15T20:56:32.182Z: Made public.

Source materials

Affected products

Products and packages named in the record

VendorProductVersion / packageStatus
composercomposer>= 2.3.0, < 2.9.6, >= 1.0.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.