CVE-2026-46420: CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') in shivammathur setup-php
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.
AI Analysis
Technical Summary
The vulnerability in shivammathur/setup-php arises because it resolves PHP version information from files controlled by the repository (.php-version, composer.lock, composer.json) and incorporates these values into generated shell or PowerShell setup scripts without adequate sanitization. This improper neutralization of special elements leads to OS command injection on GitHub Actions runners when workflows such as pull_request_target check out attacker-controlled code before invoking setup-php. The vulnerability affects versions starting from 2.25.0 up to but excluding 2.37.1, where the issue has been fixed.
Potential Impact
An attacker able to control repository files and trigger vulnerable GitHub Actions workflows can execute arbitrary OS commands on the runner environment. This can lead to limited confidentiality, integrity, and availability impacts as indicated by the CVSS vector (low confidentiality, integrity, and availability impact).
Mitigation Recommendations
Upgrade shivammathur/setup-php to version 2.37.1 or later, where this command injection vulnerability is fixed. Until upgraded, avoid running workflows that check out untrusted repository content before invoking setup-php, especially workflows using pull_request_target. Patch status is not explicitly confirmed in the advisory, but the fix is stated to be in version 2.37.1.
CVE-2026-46420: CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') in shivammathur setup-php
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.
CVSS v3.1
Score 5.6medium
Affected software
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability in shivammathur/setup-php arises because it resolves PHP version information from files controlled by the repository (.php-version, composer.lock, composer.json) and incorporates these values into generated shell or PowerShell setup scripts without adequate sanitization. This improper neutralization of special elements leads to OS command injection on GitHub Actions runners when workflows such as pull_request_target check out attacker-controlled code before invoking setup-php. The vulnerability affects versions starting from 2.25.0 up to but excluding 2.37.1, where the issue has been fixed.
Potential Impact
An attacker able to control repository files and trigger vulnerable GitHub Actions workflows can execute arbitrary OS commands on the runner environment. This can lead to limited confidentiality, integrity, and availability impacts as indicated by the CVSS vector (low confidentiality, integrity, and availability impact).
Mitigation Recommendations
Upgrade shivammathur/setup-php to version 2.37.1 or later, where this command injection vulnerability is fixed. Until upgraded, avoid running workflows that check out untrusted repository content before invoking setup-php, especially workflows using pull_request_target. Patch status is not explicitly confirmed in the advisory, but the fix is stated to be in version 2.37.1.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-05-13T22:18:22.829Z
- Cvss Version
- 3.1
- State
- PUBLISHED
- Remediation Level
- null
Threat ID: 6a5b5eac2d1edb114c7fb21d
Added to database: 07/18/2026, 11:08:28 UTC
Last enriched: 07/18/2026, 11:51:24 UTC
Last updated: 07/18/2026, 13:12:58 UTC
Views: 5
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.