GHSA-R6HR-VR92-VV28

Vulnerability from github – Published: 2026-09-29 17:57 – Updated: 2026-09-29 17:57
VLAI
Summary
PHPCSUtils: Remote code execution via eval() in AbstractArrayDeclarationSniff::getActualArrayKey()
Details

Impact

PHPCSUtils versions 1.0.0-alpha1 through 1.2.2 contain an arbitrary code execution vulnerability in PHPCSUtils\AbstractSniffs\AbstractArrayDeclarationSniff::getActualArrayKey(). The vulnerable method is reached by any sniff that extends AbstractArrayDeclarationSniff and calls getActualArrayKey().

Running PHPCS over untrusted PHP code through such a sniff, for example, in a CI pipeline that lints pull requests, or on a developer machine reviewing third-party code, could lead to arbitrary command execution on the scanning host.

The vulnerability happens when the method determines the value of an array key using eval(). A maliciously crafted array key such as 'system'('id') would be executed when the code was scanned.

Known attack vectors

Known code paths that reach the vulnerable method include the following PHPCSExtra sniffs:

  • Universal.Arrays.DuplicateArrayKey
  • Universal.Arrays.MixedArrayKeyTypes

Other packages that call AbstractArrayDeclarationSniff::getActualArrayKey() may also be vulnerable.

Patches

This issue has been fixed in PHPCSUtils 1.2.3. We recommend all users upgrade to 1.2.3 or later.

Workaround

Users who cannot upgrade immediately can disable the sniffs that reach the vulnerable method by adding <exclude> tags to their custom ruleset (replace the placeholder standard and sniff names with the ones used in your setup):

<rule ref="Standard">
    <exclude name="Standard.Category.SniffName"/>
</rule>

For example, to disable the two PHPCSExtra sniffs listed under "Known attack vectors":

<rule ref="Universal">
    <exclude name="Universal.Arrays.DuplicateArrayKey"/>
    <exclude name="Universal.Arrays.MixedArrayKeyTypes"/>
</rule>

To verify that the sniffs have been disabled, run PHPCS with the -e flag, which lists all the sniffs a standard will run. The excluded sniffs should no longer appear in the output:

phpcs -e --standard=/path/to/ruleset.xml

Credits

Many thanks to @rodrigoprimo for responsibly disclosing this vulnerability.

How can I report a security bug?

Please report security vulnerabilities privately via the "Security and quality" tab on the PHPCSUtils repository.

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "Packagist",
        "name": "phpcsstandards/phpcsutils"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "1.0.0-alpha1"
            },
            {
              "fixed": "1.2.3"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-65954"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-95"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-09-29T17:57:16Z",
    "nvd_published_at": null,
    "severity": "HIGH"
  },
  "details": "### Impact\n\nPHPCSUtils versions 1.0.0-alpha1 through 1.2.2 contain an arbitrary code execution vulnerability in `PHPCSUtils\\AbstractSniffs\\AbstractArrayDeclarationSniff::getActualArrayKey()`. The vulnerable method is reached by any sniff that extends `AbstractArrayDeclarationSniff` and calls `getActualArrayKey()`.\n\nRunning PHPCS over untrusted PHP code through such a sniff, for example, in a CI pipeline that lints pull requests, or on a developer machine reviewing third-party code, could lead to arbitrary command execution on the scanning host.\n\nThe vulnerability happens when the method determines the value of an array key using `eval()`. A maliciously crafted array key such as `\u0027system\u0027(\u0027id\u0027)` would be executed when the code was scanned.\n\n### Known attack vectors\n\nKnown code paths that reach the vulnerable method include the following PHPCSExtra sniffs:\n\n- `Universal.Arrays.DuplicateArrayKey`\n- `Universal.Arrays.MixedArrayKeyTypes`\n\nOther packages that call `AbstractArrayDeclarationSniff::getActualArrayKey()` may also be vulnerable.\n\n### Patches\n\nThis issue has been fixed in PHPCSUtils 1.2.3. We recommend all users upgrade to 1.2.3 or later.\n\n### Workaround\n\nUsers who cannot upgrade immediately can disable the sniffs that reach the vulnerable method by adding `\u003cexclude\u003e` tags to their custom ruleset (replace the placeholder standard and sniff names with the ones used in your setup):\n\n```xml\n\u003crule ref=\"Standard\"\u003e\n\t\u003cexclude name=\"Standard.Category.SniffName\"/\u003e\n\u003c/rule\u003e\n```\n\nFor example, to disable the two PHPCSExtra sniffs listed under \"Known attack vectors\":\n\n```xml\n\u003crule ref=\"Universal\"\u003e\n\t\u003cexclude name=\"Universal.Arrays.DuplicateArrayKey\"/\u003e\n\t\u003cexclude name=\"Universal.Arrays.MixedArrayKeyTypes\"/\u003e\n\u003c/rule\u003e\n```\n\nTo verify that the sniffs have been disabled, run PHPCS with the `-e` flag, which lists all the sniffs a standard will run. The excluded sniffs should no longer appear in the output:\n\n```\nphpcs -e --standard=/path/to/ruleset.xml\n```\n\n### Credits\n\nMany thanks to [@rodrigoprimo](https://github.com/rodrigoprimo) for responsibly disclosing this vulnerability.\n\n### How can I report a security bug?\n\nPlease report security vulnerabilities privately via [the \"Security and quality\" tab on the PHPCSUtils repository](https://github.com/PHPCSStandards/PHPCSUtils/security).",
  "id": "GHSA-r6hr-vr92-vv28",
  "modified": "2026-09-29T17:57:16Z",
  "published": "2026-09-29T17:57:16Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/PHPCSStandards/PHPCSUtils/security/advisories/GHSA-r6hr-vr92-vv28"
    },
    {
      "type": "WEB",
      "url": "https://github.com/PHPCSStandards/PHPCSUtils/pull/778"
    },
    {
      "type": "WEB",
      "url": "https://github.com/PHPCSStandards/PHPCSUtils/commit/9f596b50ea4498ea57b8cb341e920233b044debf"
    },
    {
      "type": "WEB",
      "url": "https://github.com/FriendsOfPHP/security-advisories/blob/master/phpcsstandards/phpcsutils/CVE-2026-65954.yaml"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/PHPCSStandards/PHPCSUtils"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ],
  "summary": "PHPCSUtils: Remote code execution via eval() in AbstractArrayDeclarationSniff::getActualArrayKey()"
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.

Loading…

Loading…

Loading…

Related by attack behaviour

Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.


Loading…