CVE-2026-59948: Composer Arbitrary File Write Outside Vendor Vulnerability
HIGHCVE-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
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).
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.
Upgrade composer/composer to 2.10.2
Upgrade composer/composer to 2.2.29
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
CVE-2026-59948 Affected Composer Versions
2 component(s)| 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?
Which Composer versions are affected?
What version fixes CVE-2026-59948?
Is composer/composer affected?
What is the CVSS score of CVE-2026-59948?
What CWE is associated with CVE-2026-59948?
How can I check Packagist dependencies for CVE-2026-59948?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}