CVE-2026-46420 setup-php: Command Injection in Repository-Derived PHP Version Resolution

Medium 5.6 Published Updated

Attackers can execute arbitrary commands on GitHub Actions runners by manipulating repository files used for PHP version resolution in setup-php.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2026-46420?

CVE-2026-46420 is a medium-severity command injection vulnerability in shivammathur setup-php, published on 17 Jul 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

setup-php is a GitHub action to set up PHP with extensions, php.ini configuration, coverage drivers, and tools. From 2.25.0 prior to 2.37.1, shivammathur/setup-php resolves the PHP version from repository-controlled files such as .php-version, composer.lock through platform-overrides.php, and composer.json through config.platform.php, and insufficiently constrains those values before incorporating them into generated shell or PowerShell setup scripts, allowing command injection on a GitHub Actions runner when workflows such as pull_request_target check out attacker-controlled contents before invoking setup-php. This issue is fixed in version 2.37.1.

Weakness: CWE-78

Which versions are affected by CVE-2026-46420?

1 open source package ship an affected version, including shivammathur/setup-php. It affects 1 product.

PackageAffectedFixed in
shivammathur/setup-php GitHub ActionsFrom 2.25.02.37.1

Products include Shivammathur Setup Php.

How do I fix CVE-2026-46420?

Upgrade shivammathur/setup-php to 2.37.1 or later.

Upgrade, and pass arguments to programs as a list instead of through a shell. More about Command injection.

Is CVE-2026-46420 being exploited?

There is no known exploitation of CVE-2026-46420 in the wild and no public exploit code.

Public exploit code: 1 proofs of concept on GitHub.

Sources

Also known as GHSA-pqwm-q9pv-ph8r.

Is CVE-2026-46420 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free