CVE-2026-59948: Composer: Arbitrary file write outside vendor via malicious transitive package name

Published Jul 8, 2026
·
Updated

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 authorizedkeys, 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.

Other sources

Composer is a dependency Manager for the PHP language. Prior to 2.2.29 and 2.10.2, a maliciously crafted package from an untrusted repository other than Packagist.org or Private Packagist can cause Composer to write attacker-controlled files outside the vendor directory and outside the project during install or update by using an invalid package name that is not correctly validated before dependency-resolution results are written or installed. This issue is fixed in versions 2.2.29 and 2.10.2.

MITRE

Affected Software

4 affected componentsFixes available
composer/composer
composer/composer<2.2.29, <2.10.2
composer/composer/composer>=1.0.0<2.2.29
2.2.29
composer/composer/composer>=2.3.0<2.10.2
2.10.2

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade composer/composer/composer to a version that resolves this vulnerability.

    Fixed in 2.2.29
  2. Upgrade

    Upgrade composer/composer/composer to a version that resolves this vulnerability.

    Fixed in 2.10.2
  3. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 2.2.29
  4. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 2.10.2
  5. Compensating control

    Do not use untrusted PHP package repositories other than Packagist.org or Private Packagist; use only repositories that validate package names correctly.

  6. Compensating control

    If you must use another repository, mirror it through an internal repository like Private Packagist.

Event History

Jul 8, 2026
CVE Published
via MITRE·07:33 PM
Data Sourced
via MITRE·07:33 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·08:16 PM
DescriptionSeverityWeakness
Jul 20, 2026
Advisory Published
via GitHub·07:15 PM
Data Sourced
via GitHub·07:15 PM
DescriptionSeverityWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-59948?

CVE-2026-59948 has a high severity rating of 7.

2

How do I fix CVE-2026-59948?

To mitigate CVE-2026-59948, upgrade Composer to versions 2.2.29 or 2.10.2 or later.

3

What type of vulnerability is CVE-2026-59948?

CVE-2026-59948 is a path traversal vulnerability affecting Composer.

4

What can attackers achieve with CVE-2026-59948?

Attackers can exploit CVE-2026-59948 to write arbitrary files outside the vendor directory.

5

Which software is affected by CVE-2026-59948?

CVE-2026-59948 affects Composer versions prior to 2.2.29 and 2.10.2.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203