{"id":"CVE-2026-46420","aliases":["GHSA-pqwm-q9pv-ph8r"],"url":"https://o3.security/vulnerability/CVE-2026-46420","summary":"setup-php: Command Injection in Repository-Derived PHP Version Resolution","details":"### Summary\n\nA command injection vulnerability was identified in `shivammathur/setup-php` when the action resolves the PHP version from repository-controlled files and uses that value while generating the platform setup script.\n\nIn affected versions, `setup-php` may read the PHP version from:\n\n- `.php-version`\n- `composer.lock` via `platform-overrides.php`\n- `composer.json` via `config.platform.php`\n\nIf an attacker can influence one of these files and the workflow executes `setup-php` in a trusted context, they may be able to execute commands on the GitHub Actions runner.\n\n### Impact\n\nThis issue is exploitable when `setup-php` is run after checking out attacker-controlled repository contents and resolves the PHP version from repository files.\n\nThe most significant example is a privileged workflow such as `pull_request_target` that checks out untrusted pull request code before invoking `setup-php`. Similar risk can also arise in other workflows that operate on attacker-controlled refs, branches, or repository contents in a trusted context.\n\nThis is not a separate security boundary when an attacker can already modify the workflow definition itself or directly control the `php-version` workflow input, since that level of access already permits arbitrary command execution in GitHub Actions.\n\n### Technical details\n\nIn affected versions, repository-derived PHP version values were insufficiently constrained before being incorporated into the generated shell or PowerShell setup script executed by the action. This could allow attacker-controlled values from supported repository files to influence script execution in trusted workflow contexts.\n\n### Remediation\n\nIf you are using `shivammathur/setup-php@v2`, no action is needed on your end. Users who pin the setup-php release version or release version SHA should upgrade to a patched version.\n\nThe fix validates PHP version inputs, constrains manifest-derived versions, hardens script generation at the execution, and includes additional checks in related input-handling paths.","published":"2026-07-17T19:51:10.253Z","modified":"2026-08-20T03:54:21.970669958Z","cvss":{"score":5.6,"severity":"MEDIUM","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L"},"epss":{"score":0.01149,"percentile":0.64145,"asOf":"2026-08-15"},"cisaKev":null,"exploitsKnown":0,"affectedPackages":[{"ecosystem":"GitHub Actions","name":"shivammathur/setup-php","fixedVersion":"2.37.1"}],"fix":{"url":"https://github.com/shivammathur/setup-php/commit/eeef37e059fb5368a5bc8ed8ce45ff54bd39b80b","label":"shivammathur/setup-php@eeef37e"},"references":[{"type":"WEB","url":"https://github.com/shivammathur/setup-php/releases/tag/2.37.1"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/46xxx/CVE-2026-46420.json"},{"type":"ADVISORY","url":"https://github.com/shivammathur/setup-php/security/advisories/GHSA-pqwm-q9pv-ph8r"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-46420"},{"type":"FIX","url":"https://github.com/shivammathur/setup-php/commit/eeef37e059fb5368a5bc8ed8ce45ff54bd39b80b"},{"type":"PACKAGE","url":"https://github.com/shivammathur/setup-php"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-08-20T03:54:21.970669958Z"}}