CVE-2026-59948: Composer Arbitrary File Write Outside Vendor Vulnerability

HIGH
Advisory Identifier: GHSA-499r-g7pc-vmp9
CVSS 7.0
CWE-787 CWE-22
Published
Advisory Summary

CVE-2026-59948 is a HIGH (CVSS 7.0) arbitrary file write outside vendor vulnerability (CWE-787: Out-of-bounds Write) affecting Composer libraries in the Packagist ecosystem. The issue involves arbitrary file write outside vendor via malicious transitive package name. Remediation is available by upgrading affected packages to version 2.10.2, 2.2.29.

CVE-2026-59948 at a Glance

CVE Identifier CVE-2026-59948
GHSA Identifier GHSA-499r-g7pc-vmp9
Severity HIGH
CVSS v3.1 Base Score 7.0
CWE Classification CWE-787: Out-of-bounds Write
Affected Product Composer
Package Ecosystem Packagist
Published Date
Last Updated

Security Impact

CVSS: 7.0

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H).

Attack Vector Local (AV:L)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-59948

To remediate this vulnerability, upgrade all affected 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.2
Upgrade composer/composer to 2.10.2
composer/composer fixed: 2.2.29
Upgrade composer/composer to 2.2.29
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-59948, inspect your project dependencies for Composer:

inspect dependencies for composer/composer

Analyze the terminal output to locate any version of 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.2), 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-787: Out-of-bounds Write, where the product writes data past the end, or before the beginning, of the intended buffer. In 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 A maliciously crafted package, published on an untrusted third party repository other than Packagist.org or Private Packagist, can cause Composer to write files outside the `vendor/` directory and outside your project, with attacker-controlled content, during a normal `install` or `update` through using an invalid package name, which was not correctly validated by Composer. This is an arbitrary file write that can be used to execute code outside the Composer project's context in which you expected the package code to execute (for example by writing shell startup files, SSH `authorized_keys`, or a cron entry). It is a supply-chain issue: it requires a malicious or compromised package to be present in the dependency graph, it is not otherwise remotely exploitable against a machine. The fix makes Composer validate every package produced by dependency resolution before anything is written to `composer.lock` or installed, and abort with a security error if a package name is not a valid `vendor/package` name. ## Am I affected? You may be affected if you install packages from an untrusted third party repository, which does not sufficiently validate package names. Packagist.org and Private Packagist are safe, as they validate package names correctly. ## Patched versions Fixed in **2.2.29** and **2.10.2**. Composer 1.x is also affected and you should move to a safe 2.x release. ## Workarounds Do not use untrusted package repositories. If you have to, mirror them through an internal repository like Private Packagist.

CVE-2026-59948 Affected Composer Versions

2 component(s)
Fixed Versions:
2.10.22.2.29
Product / Package Ecosystem Affected Versions Fixed Version
composer/composer
Packagist
≥ 2.3.0
< 2.10.2
2.10.2
composer/composer
Packagist
≥ 1.0.0
< 2.2.29
2.2.29

References

Frequently Asked Questions

What is CVE-2026-59948?
CVE-2026-59948 is a security vulnerability in Composer involving Arbitrary file write outside vendor via malicious transitive package name under CWE-787: Out-of-bounds Write.
Which Composer versions are affected?
Affected versions include releases prior to 2.10.2, 2.2.29 across affected packages: composer/composer.
What version fixes CVE-2026-59948?
Upgrading to 2.10.2, 2.2.29 (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.2, 2.2.29. Upgrade your dependency to 2.10.2, 2.2.29 or later.
What is the CVSS score of CVE-2026-59948?
CVE-2026-59948 has a CVSS v3.1 base score of 7.0 (HIGH) with vector string CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2026-59948?
CVE-2026-59948 is classified under CWE-787: Out-of-bounds Write (The product writes data past the end, or before the beginning, of the intended buffer.).
How can I check Packagist dependencies for CVE-2026-59948?
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-499r-g7pc-vmp9",
  "modified" : "2026-07-20T19:15:29Z",
  "published" : "2026-07-20T19:15:29Z",
  "aliases" : [ "CVE-2026-59948" ],
  "summary" : "Composer: Arbitrary file write outside vendor via malicious transitive package name",
  "details" : "## Summary\n\nA maliciously crafted package, published on an untrusted third party repository other than Packagist.org or Private Packagist, can cause Composer to write files outside the `vendor/` directory and outside your project, with attacker-controlled content, during a normal `install` or `update` through using an invalid package name, which was not correctly validated by Composer.\n\nThis is an arbitrary file write that can be used to execute code outside the Composer project's context in which you expected the package code to execute (for example by writing shell startup files, SSH `authorized_keys`, or a cron entry). It is a supply-chain issue: it requires a malicious or compromised package to be present in the dependency graph, it is not otherwise remotely exploitable against a machine.\n\nThe fix makes Composer validate every package produced by dependency resolution before anything is written to `composer.lock` or installed, and abort with a security error if a package name is not a valid `vendor/package` name.\n\n## Am I affected?\n\nYou may be affected if you install packages from an untrusted third party repository, which does not sufficiently validate package names. Packagist.org and Private Packagist are safe, as they validate package names correctly.\n\n## Patched versions\n\nFixed in **2.2.29** and **2.10.2**. Composer 1.x is also affected and you should move to a safe 2.x release.\n\n## Workarounds\n\nDo not use untrusted package repositories. If you have to, mirror them through an internal repository like Private Packagist.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "composer/composer"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.3.0"
      }, {
        "fixed" : "2.10.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "composer/composer"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.0.0"
      }, {
        "fixed" : "2.2.29"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/composer/composer/security/advisories/GHSA-499r-g7pc-vmp9"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-59948"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/composer/composer/commit/502c6c4f699802d9cf464728b3e8a95674f919a0"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/composer/composer/commit/c50b1efd13ebd73f6dca19b31424c5a02bf93cc1"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/composer/composer"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/composer/composer/releases/tag/2.10.2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/composer/composer/releases/tag/2.2.29"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22", "CWE-787" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-07-20T19:15:29Z",
    "nvd_published_at" : "2026-07-08T20:16:59Z"
  }
}