If you clone a repository someone else controls and run composer install inside it, specially crafted branch names in that repository can run commands on your machine. This is command injection: Composer didn't handle the branch names safely when it used them in commands.

See the Composer advisory and the fixes for 2.7 and 2.2 LTS.

Who is affected

Anyone running composer/composer who runs composer install inside a git or Mercurial (hg) repository they don't trust. The Composer team notes this requires cloning an untrusted repository first.

Running composer install in your own repositories, or ones you trust, isn't a risk from this flaw.

What to do

Update Composer to 2.7.7, or to 2.2.24 if you're on the 2.2 LTS line. Until you can, the Composer team's advice is to avoid cloning repositories that may be compromised.

A related advisory fixed in the same releases covers composer status, reinstall and remove on packages installed from git.