{"id":"CVE-2026-46420","aliases":["CVE-2026-46420","GHSA-pqwm-q9pv-ph8r"],"related":[],"kind":"vulnerability","state":"published","title":"setup-php: Command Injection in Repository-Derived PHP Version Resolution","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"### 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.","format":"markdown","source":"ghsa"},{"lang":"es","text":"setup-php es una acción de GitHub para configurar PHP con extensiones, configuración de php.ini, controladores de cobertura y herramientas. Desde la versión 2.25.0 anterior a la 2.37.1, shivammathur/setup-php resuelve la versión de PHP de archivos controlados por el repositorio como .php-version, composer.lock a través de platform-overrides.php, y composer.json a través de config.platform.php, y restringe insuficientemente esos valores antes de incorporarlos en scripts de configuración de shell o PowerShell generados, permitiendo la inyección de comandos en un ejecutor de GitHub Actions cuando flujos de trabajo como pull_request_target extraen contenido controlado por el atacante antes de invocar setup-php. Este problema está solucionado en la versión 2.37.1.","source":"nvd"}],"published":"2026-05-20T15:31:52.000Z","modified":"2026-10-24T20:10:00.137Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L","score":5.6,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L","score":5.6,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L","score":5.6,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"}],"cwes":["CWE-78"],"affected":[{"ranges":[{"version":">= 2.25.0, < 2.37.1","status":"affected"}],"vendor":"shivammathur","product":"setup-php","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"2.25.0","status":"affected","fixed":"2.37.1"}],"ecosystem":"GitHub Actions","package":"shivammathur/setup-php","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"2.25.0","fixed":"2.37.1"}],"vendor":"shivammathur","product":"setup_php","cpe":"cpe:2.3:a:shivammathur:setup_php:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/shivammathur/setup-php/security/advisories/GHSA-pqwm-q9pv-ph8r","tags":["patch","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/shivammathur/setup-php/commit/eeef37e059fb5368a5bc8ed8ce45ff54bd39b80b","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/shivammathur/setup-php/releases/tag/2.37.1","tags":["product","release-notes","x-refsource-misc"],"sources":["cvelist","nvd"]},{"url":"https://github.com/shivammathur/setup-php","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-07-20T18:09:22.675Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-46420","url":"https://www.cve.org/CVERecord?id=CVE-2026-46420","licence":"CVE Terms of Use","modified":"2026-07-20T18:15:56.324Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-pqwm-q9pv-ph8r","url":"https://github.com/advisories/GHSA-pqwm-q9pv-ph8r","licence":"CC-BY-4.0","modified":"2026-05-20T15:56:29.321Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-46420","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-46420","licence":"Public domain","modified":"2026-10-24T20:10:00.137Z"}],"updatedAt":"2026-11-25T22:59:28.528Z","epss":{"score":0.01538,"percentile":0.75619,"date":"2026-12-01T12:00:22.000Z"}}