/

CVE-2026-65954

Severity:

HIGH RISK

(8.6)

Code Injection (CWE-95) in PHPCSUtils Array Key Sniff

CVE-2026-65954

Deferred

Vulnerability type

Category:

Code Injection

CWE:

CWE-95

Impact:

Arbitrary Command Execution

Severity:

HIGH RISK

(8.6)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

PHPCSUtils evaluates attacker-controlled PHP array-key expressions with eval(), allowing code embedded in scanned source to run during analysis. When an extending sniff processes untrusted PHP code through affected array-key handling paths, an attacker may execute arbitrary commands on the scanning host.

PHPCSUtils evaluates attacker-controlled PHP array-key expressions with eval(), allowing code embedded in scanned source to run during analysis. When an extending sniff processes untrusted PHP code through affected array-key handling paths, an attacker may execute arbitrary commands on the scanning host.

Affected context

The vulnerability occurs in PHPCSUtils versions that use AbstractArrayDeclarationSniff::getActualArrayKey() to evaluate array-key expressions. It becomes risky when a scanning workflow analyzes untrusted PHP source and uses reachable sniff paths such as Universal.Arrays.DuplicateArrayKey or Universal.Arrays.MixedArrayKeyTypes.

The vulnerability occurs in PHPCSUtils versions that use AbstractArrayDeclarationSniff::getActualArrayKey() to evaluate array-key expressions. It becomes risky when a scanning workflow analyzes untrusted PHP source and uses reachable sniff paths such as Universal.Arrays.DuplicateArrayKey or Universal.Arrays.MixedArrayKeyTypes.

Exploit preconditions

  • Attack surface: PHP source-code scanning and linting workflows
  • Required access: Ability to submit, modify, or cause untrusted PHP code to be scanned
  • Trigger point: Processing of attacker-controlled array-key expressions by an extending sniff
  • Why exploitation is possible: The scanner evaluates expressions through eval(), causing embedded callback-form keys or other executable expressions to run with the scanner's privileges
  • Attack surface: PHP source-code scanning and linting workflows
  • Required access: Ability to submit, modify, or cause untrusted PHP code to be scanned
  • Trigger point: Processing of attacker-controlled array-key expressions by an extending sniff
  • Why exploitation is possible: The scanner evaluates expressions through eval(), causing embedded callback-form keys or other executable expressions to run with the scanner's privileges

Why this happens

The underlying issue is the use of dynamic PHP evaluation to determine the value of an array key. Calling eval() on source-derived expressions treats scanned input as executable code rather than inert syntax, which maps to CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code.

The underlying issue is the use of dynamic PHP evaluation to determine the value of an array key. Calling eval() on source-derived expressions treats scanned input as executable code rather than inert syntax, which maps to CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code.

Potential impact

  • An attacker may execute arbitrary commands on the scanning host.
  • Credentials, source code, or build artifacts could be exposed.
  • The scanning environment could be modified or disrupted.
  • Compromised analysis jobs could affect downstream CI/CD systems.
  • An attacker may execute arbitrary commands on the scanning host.
  • Credentials, source code, or build artifacts could be exposed.
  • The scanning environment could be modified or disrupted.
  • Compromised analysis jobs could affect downstream CI/CD systems.

General mitigation guidance

Mitigation generally focuses on eliminating dynamic evaluation of source-derived expressions and reducing trust in analyzed code.

Common defensive patterns include:

  • Replacing eval() with parser-based, non-executing syntax analysis.
  • Treating array-key expressions as data and evaluating only narrowly defined, safe constructs where necessary.
  • Running scanners with least-privilege operating-system accounts and isolated, disposable environments.
  • Restricting network access, filesystem permissions, and secret availability for analysis jobs.
  • Applying trust and provenance policies before untrusted code enters automated scanning workflows.

Mitigation generally focuses on eliminating dynamic evaluation of source-derived expressions and reducing trust in analyzed code.

Common defensive patterns include:

  • Replacing eval() with parser-based, non-executing syntax analysis.
  • Treating array-key expressions as data and evaluating only narrowly defined, safe constructs where necessary.
  • Running scanners with least-privilege operating-system accounts and isolated, disposable environments.
  • Restricting network access, filesystem permissions, and secret availability for analysis jobs.
  • Applying trust and provenance policies before untrusted code enters automated scanning workflows.

How teams detect issues like this

Organizations can identify this class of issue through:

  • Static analysis rules that flag eval() and other dynamic execution APIs.
  • Code review checks for execution of source text during parsing or linting.
  • Dependency and call-graph analysis to identify scanner extensions that process untrusted code.
  • CI policies that prohibit dynamic evaluation in analysis tooling.
  • Runtime monitoring for unexpected child processes, command execution, or filesystem changes from scanning jobs.

Organizations can identify this class of issue through:

  • Static analysis rules that flag eval() and other dynamic execution APIs.
  • Code review checks for execution of source text during parsing or linting.
  • Dependency and call-graph analysis to identify scanner extensions that process untrusted code.
  • CI policies that prohibit dynamic evaluation in analysis tooling.
  • Runtime monitoring for unexpected child processes, command execution, or filesystem changes from scanning jobs.

Sources

SourceLink
github.comgithub.com/PHPCSStandards/PHPCSUtils/commit/e8648633ff5b8219b1b3e6346ce85abfc30f1429
github.comgithub.com/PHPCSStandards/PHPCSUtils/releases/tag/1.2.3
github.comgithub.com/PHPCSStandards/PHPCSUtils/security/advisories/GHSA-r6hr-vr92-vv28

Frequently asked

questions

It can be exploited through a remote submission or repository workflow when untrusted PHP code is accepted for scanning and the scanner is reachable through that workflow. Direct network access to the scanning host is not necessarily required.

An attacker needs a way to influence PHP source code that is processed by an affected sniff or by another reachable code path invoking the vulnerable array-key handling logic.

The safest pattern is to remove dynamic evaluation from source analysis and use a non-executing parser or restricted syntax interpretation instead.

Treat scanned code as hostile input, prohibit dynamic execution APIs in analysis tools, isolate scanning jobs, minimize their privileges, and monitor them for unexpected process or filesystem activity.

It can be exploited through a remote submission or repository workflow when untrusted PHP code is accepted for scanning and the scanner is reachable through that workflow. Direct network access to the scanning host is not necessarily required.

An attacker needs a way to influence PHP source code that is processed by an affected sniff or by another reachable code path invoking the vulnerable array-key handling logic.

The safest pattern is to remove dynamic evaluation from source analysis and use a non-executing parser or restricted syntax interpretation instead.

Treat scanned code as hostile input, prohibit dynamic execution APIs in analysis tools, isolate scanning jobs, minimize their privileges, and monitor them for unexpected process or filesystem activity.

Find out what's already
exploitable in your codebase.