Skip to content
Heist/ feed
Back to feed
Medium

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

Type: advisorySources: OSV

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.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2026-46420
Confirmed fixed CVEs
Not specified
Updated in this feed
7 Nov 2026, 04:11 UTC · Revision 1

Source evidence

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

core-osv · Original source

Published 17 Jul 2026, 19:51 UTC

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.

osv:CVE-2026-46420
Complete source record
{
  "id": "49079868628f4f22968af54ab3704c3c937efcd511f04ba13f0d1bc955bc134b",
  "url": "https://osv.dev/vulnerability/CVE-2026-46420",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "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.",
    "evidence": "osv:CVE-2026-46420",
    "products": [],
    "severity": "medium",
    "structured": {
      "id": "CVE-2026-46420",
      "aliases": [
        "CVE-2026-46420",
        "GHSA-pqwm-q9pv-ph8r"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/shivammathur/setup-php",
              "type": "GIT",
              "events": [
                {
                  "introduced": "1fdc5e773bb54b5aa541c73679d6e9acc692d0cd"
                },
                {
                  "fixed": "7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc"
                },
                {
                  "fixed": "eeef37e059fb5368a5bc8ed8ce45ff54bd39b80b"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "cpe": "cpe:2.3:a:shivammathur:setup_php:*:*:*:*:*:*:*:*",
                    "range": [
                      {
                        "introduced": "2.25.0"
                      },
                      {
                        "fixed": "2.37.1"
                      }
                    ],
                    "source": "CPE_RANGE"
                  },
                  {
                    "range": [
                      {
                        "fixed": "eeef37e059fb5368a5bc8ed8ce45ff54bd39b80b"
                      }
                    ],
                    "source": "REFERENCES_COMMIT"
                  },
                  {
                    "range": [
                      {
                        "fixed": "7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc"
                      }
                    ],
                    "source": "REFERENCES_TAG",
                    "original_tag": "2.37.1"
                  }
                ]
              }
            }
          ],
          "versions": [
            "2.37.0",
            "2.36.0",
            "2.35.5",
            "2.35.4",
            "2.35.3",
            "2.35.2",
            "2.35.1",
            "2.35.0",
            "2.34.1",
            "2.34.0",
            "2.33.0",
            "2.32.0",
            "2.31.1",
            "2.31.0",
            "2.30.5",
            "2.30.4",
            "2.30.3",
            "2.30.2",
            "2.30.1",
            "2.30.0",
            "2.29.0",
            "2.28.0",
            "2.27.1",
            "2.27.0",
            "2.26.0",
            "2.25.5",
            "2.25.4",
            "2.25.3",
            "2.25.2",
            "2.25.1",
            "2.25.0"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-46420.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:49.424837689Z",
      "provider": "osv",
      "references": [
        "https://github.com/shivammathur/setup-php/releases/tag/2.37.1",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/46xxx/CVE-2026-46420.json",
        "https://github.com/shivammathur/setup-php/security/advisories/GHSA-pqwm-q9pv-ph8r",
        "https://nvd.nist.gov/vuln/detail/CVE-2026-46420",
        "https://github.com/shivammathur/setup-php/commit/eeef37e059fb5368a5bc8ed8ce45ff54bd39b80b"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-78"
        ],
        "cna_assigner": "GitHub_M",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/46xxx/CVE-2026-46420.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2026-46420",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 518027,
  "published_at": "2026-07-17T19:51:10.253+00:00"
}