CVE-2026-84361: Composer/composer Remote Code Execution Vulnerability

HIGH
Advisory Identifier: GHSA-rvx4-ffvw-m9q3
CWE-78
Published
Advisory Summary

CVE-2026-84361 is a HIGH remote code execution vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Composer/composer libraries in the Packagist ecosystem. The issue involves composer arbitrary command execution via a malicious package's perforce source url. Remediation is available by upgrading affected packages to version 2.10.3, 2.2.30.

CVE-2026-84361 at a Glance

CVE Identifier CVE-2026-84361
GHSA Identifier GHSA-rvx4-ffvw-m9q3
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product Composer/composer
Package Ecosystem Packagist
Published Date
Last Updated

How to Fix CVE-2026-84361

To remediate this vulnerability, upgrade all affected Composer/composer dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

composer/composer fixed: 2.10.3
Upgrade composer/composer to 2.10.3
composer/composer fixed: 2.2.30
Upgrade composer/composer to 2.2.30
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for composer/composer

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-84361, inspect your project dependencies for Composer/composer:

inspect dependencies for composer/composer

Analyze the terminal output to locate any version of Composer/composer in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.10.3), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product constructs all or part of an os command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended os command when it is sent to a downstream component. In Composer/composer, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary If the `p4` Perforce CLI client is installed, a malicious dependency package from a package repository allowing arbitrary perforce source URLs (packagist.org is safe) could execute arbitrary commands when running `composer install` or `composer update`. Composer passed a package's Perforce source address to the `p4` CLI client without validating it. The `p4` CLI client accepts addresses that mean "run this local command" instead of "connect to this server". This is remote code execution with the privileges of the user or CI account running Composer. ## Am I affected? You are only affected if all of the following are true: - The Perforce `p4` command line client is installed and on the `PATH` of the machine running Composer. - An attacker can control a package metadata's `source` section with a perforce type. Packagist.org does not allow perforce source metadata, so you are only exploitable if you rely on another Composer repository (any custom `composer`-type repository, or an inline `package` repository entry), or a `composer.lock` file you obtained from somewhere you do not trust. - The package gets installed from source, either because it has no dist artifact or because source installs are selected (for example `--prefer-source`). Plainly not affected: anyone without the `p4` client installed, which is the large majority of Composer users. Perforce is an optional VCS integration. Also not affected: projects that only consume packages from Packagist.org, which does not allow Perforce source repositories and therefore cannot serve a package with a Perforce source address. Most realistic way to get hit: a developer workstation or CI image that has Perforce tooling installed, pulling packages from a private or third party Composer repository that an attacker has compromised. ## Patched versions Composer now validates Perforce source addresses before handing them to the `p4` client, and accepts only real network endpoints (an optional `tcp`/`ssl` transport with a host and port). Addresses that make the client spawn a local process are rejected, and the package fails validation on both update and install, before any `p4` command runs. Fixed in Composer **2.10.3** and **2.2.30**. Note: If you legitimately use Perforce with an unusual `P4PORT` value that is not a plain host and port, Composer will now reject it. ## Workarounds Upgrading is the only complete fix. Risk reduction short of upgrading: - Remove the `p4` client from the `PATH` of machines that run Composer but do not use Perforce. This fully blocks this specific attack, since the vulnerability depends on that client being present. - Restrict configured repositories to sources you control or trust, and treat lock files from untrusted sources as untrusted input.

CVE-2026-84361 Affected Composer/composer Versions

2 component(s)
Fixed Versions:
2.10.32.2.30
Product / Package Ecosystem Affected Versions Fixed Version
composer/composer
Packagist
≥ 2.3.0
< 2.10.3
2.10.3
composer/composer
Packagist
≥ 1.0
< 2.2.30
2.2.30

References

Frequently Asked Questions

What is CVE-2026-84361?
CVE-2026-84361 is a security vulnerability in Composer/composer involving Composer arbitrary command execution via a malicious package's Perforce source URL under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which Composer/composer versions are affected?
Affected versions include releases prior to 2.10.3, 2.2.30 across affected packages: composer/composer.
What version fixes CVE-2026-84361?
Upgrading to 2.10.3, 2.2.30 (or the latest patched release for your respective branch) resolves the vulnerability.
Is composer/composer affected?
Yes, composer/composer is affected in releases prior to 2.10.3, 2.2.30. Upgrade your dependency to 2.10.3, 2.2.30 or later.
What CWE is associated with CVE-2026-84361?
CVE-2026-84361 is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.).
How can I check Packagist dependencies for CVE-2026-84361?
Run the dependency tree command: 'inspect dependencies for composer/composer'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-rvx4-ffvw-m9q3",
  "modified" : "2026-09-08T21:25:41Z",
  "published" : "2026-09-08T21:25:41Z",
  "aliases" : [ "CVE-2026-84361" ],
  "summary" : "Composer arbitrary command execution via a malicious package's Perforce source URL",
  "details" : "## Summary\n\nIf the `p4` Perforce CLI client is installed, a malicious dependency package from a package repository allowing arbitrary perforce source URLs (packagist.org is safe) could execute arbitrary commands when running `composer install` or `composer update`. Composer passed a package's Perforce source address to the `p4` CLI client without validating it. The `p4` CLI client accepts addresses that mean \"run this local command\" instead of \"connect to this server\". This is remote code execution with the privileges of the user or CI account running Composer.\n\n## Am I affected?\n\nYou are only affected if all of the following are true:\n\n- The Perforce `p4` command line client is installed and on the `PATH` of the machine running Composer.\n- An attacker can control a package metadata's `source` section with a perforce type. Packagist.org does not allow perforce source metadata, so you are only exploitable if you rely on another Composer repository (any custom `composer`-type repository, or an inline `package` repository entry), or a `composer.lock` file you obtained from somewhere you do not trust.\n- The package gets installed from source, either because it has no dist artifact or because source installs are selected (for example `--prefer-source`).\n\nPlainly not affected: anyone without the `p4` client installed, which is the large majority of Composer users. Perforce is an optional VCS integration. Also not affected: projects that only consume packages from Packagist.org, which does not allow Perforce source repositories and therefore cannot serve a package with a Perforce source address.\n\nMost realistic way to get hit: a developer workstation or CI image that has Perforce tooling installed, pulling packages from a private or third party Composer repository that an attacker has compromised.\n\n## Patched versions\n\nComposer now validates Perforce source addresses before handing them to the `p4` client, and accepts only real network endpoints (an optional `tcp`/`ssl` transport with a host and port). Addresses that make the client spawn a local process are rejected, and the package fails validation on both update and install, before any `p4` command runs. Fixed in Composer **2.10.3** and **2.2.30**.\n\nNote: If you legitimately use Perforce with an unusual `P4PORT` value that is not a plain host and port, Composer will now reject it.\n\n## Workarounds\n\nUpgrading is the only complete fix.\n\nRisk reduction short of upgrading:\n\n- Remove the `p4` client from the `PATH` of machines that run Composer but do not use Perforce. This fully blocks this specific attack, since the vulnerability depends on that client being present.\n- Restrict configured repositories to sources you control or trust, and treat lock files from untrusted sources as untrusted input.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "composer/composer"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.3.0"
      }, {
        "fixed" : "2.10.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "composer/composer"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.0"
      }, {
        "fixed" : "2.2.30"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/composer/composer/security/advisories/GHSA-rvx4-ffvw-m9q3"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-84361"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/composer/composer/commit/0aac50528e83ed635cf788333635897469440220"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/composer/composer/commit/199ad81a9cc6a2a5164ad79a8da26b2e19e521af"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/composer/composer"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/composer/composer/releases/tag/2.10.3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/composer/composer/releases/tag/2.2.30"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-78" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-09-08T21:25:41Z",
    "nvd_published_at" : "2026-09-01T21:18:47Z"
  }
}