HighGHSA-499r-g7pc-vmp9BIT-composer-2026-59948CVE-2026-59948

Composer: Arbitrary file write outside vendor via malicious transitive package name

Published 20 Jul 2026 · Updated 20 Jul 2026

Is your project on an affected composer/composer?

Private repo? Upload its lockfile instead, or connect GitHub to check every repo.

Look after several Laravel or PHP apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie

Affected packages

Affected
>=2.3.0 <2.10.2
Fixed in
2.10.2
Update to the fixed version for your release line, for example:composer require composer/composer:^2.10.2
Affected
>=1.0.0 <2.2.29
Fixed in
2.2.29
Update to the fixed version for your release line, for example:composer require composer/composer:^2.2.29

Details

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.

Is GHSA-499r-g7pc-vmp9 in any of your client repos?

Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected composer/composer, and gives you the command that fixes it.

More advisories for composer/composer

  • MediumCVE-2026-59944Composer: GHSA-gjfg-22fp-rrxx fix bypass via symlinked package bin path · 2 Oct 2026
  • HighCVE-2026-84361Composer arbitrary command execution via a malicious package's Perforce source URL · 8 Sept 2026
  • MediumCVE-2026-59946Composer: Path traversal in package bin field lets dependencies chmod arbitrary host files · 20 Jul 2026
  • MediumCVE-2026-59947Composer: URL-embedded HTTP-Basic username leaks to verbose logs (GitHub PAT exposure) · 20 Jul 2026
  • HighCVE-2026-45793Github Actions issued GITHUB_TOKEN disclosure in GitHub Actions logs · 19 May 2026
  • HighCVE-2026-40176Composer has a command injection via malicious perforce repository · 14 Apr 2026
All 17 advisories for composer/composer

References

Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.