/

CVE-2026-45293

Severity:

HIGH RISK

(8.6)

Eval Injection (CWE-95) in WordPress Coding Standards

CVE-2026-45293

Awaiting Analysis

Vulnerability type

Category:

Eval Injection

CWE:

CWE-95

Impact:

Arbitrary Command Execution on Analysis Host

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

WordPress Coding Standards (WordPressCS) contained an eval injection flaw where a PHP_CodeSniffer sniff reconstructed user-provided arguments and executed them via eval() during static analysis.

When PHPCS with WordPressCS is run against untrusted PHP code, a crafted enqueued resource version parameter can trigger arbitrary command execution on the scanning host, turning the linting process itself into an attack vector.

WordPress Coding Standards (WordPressCS) contained an eval injection flaw where a PHP_CodeSniffer sniff reconstructed user-provided arguments and executed them via eval() during static analysis.

When PHPCS with WordPressCS is run against untrusted PHP code, a crafted enqueued resource version parameter can trigger arbitrary command execution on the scanning host, turning the linting process itself into an attack vector.

Affected context

This vulnerability occurs in environments where PHP_CodeSniffer is used together with WordPress Coding Standards versions 0.14.1 through 3.4.1, specifically with the WordPress or WordPress-Extra rulesets enabled.

It becomes relevant when scanning or linting PHP code that is not fully trusted—such as code in pull requests, third-party themes or plugins, or external contributions—because attacker-controlled arguments to WordPress enqueue functions are interpreted during the sniff's analysis.

This vulnerability occurs in environments where PHP_CodeSniffer is used together with WordPress Coding Standards versions 0.14.1 through 3.4.1, specifically with the WordPress or WordPress-Extra rulesets enabled.

It becomes relevant when scanning or linting PHP code that is not fully trusted—such as code in pull requests, third-party themes or plugins, or external contributions—because attacker-controlled arguments to WordPress enqueue functions are interpreted during the sniff's analysis.

Exploit preconditions

  • Attack surface: The PHPCS/WordPressCS static analysis process on the machine performing code scans.
  • Required access: Ability to submit or control PHP source code that will be scanned (e.g., via repository access, pull requests, or uploaded extensions).
  • Trigger point: Execution of the WordPress.WP.EnqueuedResourceParameters sniff when it inspects calls like wp_enqueue_script() and processes their $ver parameter.
  • Why exploitation is possible: The sniff reconstructs the $ver argument and passes it into eval() via the is_falsy() method, allowing attacker-controlled code to be evaluated on the scanning host outside of any runtime sandbox.
  • Attack surface: The PHPCS/WordPressCS static analysis process on the machine performing code scans.
  • Required access: Ability to submit or control PHP source code that will be scanned (e.g., via repository access, pull requests, or uploaded extensions).
  • Trigger point: Execution of the WordPress.WP.EnqueuedResourceParameters sniff when it inspects calls like wp_enqueue_script() and processes their $ver parameter.
  • Why exploitation is possible: The sniff reconstructs the $ver argument and passes it into eval() via the is_falsy() method, allowing attacker-controlled code to be evaluated on the scanning host outside of any runtime sandbox.

Why this happens

The underlying bug is the use of eval() on reconstructed data derived from analyzed source code within a static analysis tool.

Instead of treating the $ver argument as opaque or evaluating it in a controlled, non-executable manner, the sniff's is_falsy() logic directly executes the string as PHP, leading to CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code.

Conceptually, this represents an insecure pattern where analysis tooling treats user-supplied code as executable directives during inspection, giving attackers a way to break out of the "read-only" analysis context and run commands on the host.

The underlying bug is the use of eval() on reconstructed data derived from analyzed source code within a static analysis tool.

Instead of treating the $ver argument as opaque or evaluating it in a controlled, non-executable manner, the sniff's is_falsy() logic directly executes the string as PHP, leading to CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code.

Conceptually, this represents an insecure pattern where analysis tooling treats user-supplied code as executable directives during inspection, giving attackers a way to break out of the "read-only" analysis context and run commands on the host.

Potential impact

  • Arbitrary command execution on machines running PHPCS with affected WordPressCS rulesets.
  • Compromise of CI/CD pipeline runners that lint untrusted or contributed PHP code.
  • Theft or modification of source code and secrets stored on the analysis host.
  • Lateral movement from compromised build or review hosts into wider development infrastructure.
  • Disruption of automated quality and security checks through sabotage of the scanning environment.
  • Arbitrary command execution on machines running PHPCS with affected WordPressCS rulesets.
  • Compromise of CI/CD pipeline runners that lint untrusted or contributed PHP code.
  • Theft or modification of source code and secrets stored on the analysis host.
  • Lateral movement from compromised build or review hosts into wider development infrastructure.
  • Disruption of automated quality and security checks through sabotage of the scanning environment.

General mitigation guidance

Mitigation focuses on removing dynamic evaluation from analysis logic and tightening how static analysis tools interpret source code.

Secure patterns include:

  • Avoiding eval() and similar dynamic execution primitives inside sniffs and code quality rules.
  • Treating analyzed source as data only, and using parsers or abstract syntax trees rather than execution to reason about code behavior.
  • Constraining what argument values are inspected and normalizing them safely instead of reconstructing and executing them.
  • Running static analysis tools under least-privilege accounts and in isolated environments so that, even if a rule misbehaves, impact is limited.
  • Establishing internal review and security checks for custom or third-party rulesets to detect unsafe execution patterns before deployment.

Mitigation focuses on removing dynamic evaluation from analysis logic and tightening how static analysis tools interpret source code.

Secure patterns include:

  • Avoiding eval() and similar dynamic execution primitives inside sniffs and code quality rules.
  • Treating analyzed source as data only, and using parsers or abstract syntax trees rather than execution to reason about code behavior.
  • Constraining what argument values are inspected and normalizing them safely instead of reconstructing and executing them.
  • Running static analysis tools under least-privilege accounts and in isolated environments so that, even if a rule misbehaves, impact is limited.
  • Establishing internal review and security checks for custom or third-party rulesets to detect unsafe execution patterns before deployment.

How teams detect issues like this

Detection of this class of issue typically involves examining how analysis tooling handles user-controlled code and identifying dynamic execution paths.

Effective approaches include:

  • Static analysis rules targeting eval(), create_function(), and similar constructs within sniffs, rulesets, or linters.
  • Code review guidelines that flag any use of dynamic evaluation in tooling that processes untrusted input.
  • Security testing of CI pipelines, including scanning linters and plugins as part of the supply chain rather than focusing solely on application code.
  • Policy enforcement that restricts or forbids dynamic code execution in analysis environments, supported by automated tooling that scans for such patterns before new rulesets are adopted.

Detection of this class of issue typically involves examining how analysis tooling handles user-controlled code and identifying dynamic execution paths.

Effective approaches include:

  • Static analysis rules targeting eval(), create_function(), and similar constructs within sniffs, rulesets, or linters.
  • Code review guidelines that flag any use of dynamic evaluation in tooling that processes untrusted input.
  • Security testing of CI pipelines, including scanning linters and plugins as part of the supply chain rather than focusing solely on application code.
  • Policy enforcement that restricts or forbids dynamic code execution in analysis environments, supported by automated tooling that scans for such patterns before new rulesets are adopted.

Sources

SourceLink
github.comgithub.com/WordPress/WordPress-Coding-Standards/commit/a29048d0bbef5cf25d42349c74e4072d3cbc8325
github.comgithub.com/WordPress/WordPress-Coding-Standards/pull/2771
github.comgithub.com/WordPress/WordPress-Coding-Standards/releases/tag/3.4.1
github.comgithub.com/WordPress/WordPress-Coding-Standards/security/advisories/GHSA-3pwp-g2mj-5p3v

Frequently asked

questions

It can be indirectly remote when attackers can submit PHP code that will be automatically scanned—for example via remote repository contributions or external submissions to CI pipelines. The actual execution happens on the scanning host, triggered by the analysis process.

An attacker must be able to control PHP code that is processed by PHPCS with the affected WordPressCS rulesets. This often corresponds to contributor-level access, pull request capabilities, or any workflow where untrusted code is linted.

The safest pattern is to remove eval() and any dynamic execution from the sniff, replacing it with non-executing analysis methods such as syntax inspection, literal checks, or AST-based evaluation. Additionally, enforce a policy that static analysis rules never execute incoming source code.

Treat linters, sniffs, and static analysis plugins as part of the security-sensitive toolchain: audit them for dynamic execution, subject them to secure code review, and run them in constrained environments. Establish guidelines that prohibit eval-like constructs in analysis tooling and back these with automated checks in development and CI.

It can be indirectly remote when attackers can submit PHP code that will be automatically scanned—for example via remote repository contributions or external submissions to CI pipelines. The actual execution happens on the scanning host, triggered by the analysis process.

An attacker must be able to control PHP code that is processed by PHPCS with the affected WordPressCS rulesets. This often corresponds to contributor-level access, pull request capabilities, or any workflow where untrusted code is linted.

The safest pattern is to remove eval() and any dynamic execution from the sniff, replacing it with non-executing analysis methods such as syntax inspection, literal checks, or AST-based evaluation. Additionally, enforce a policy that static analysis rules never execute incoming source code.

Treat linters, sniffs, and static analysis plugins as part of the security-sensitive toolchain: audit them for dynamic execution, subject them to secure code review, and run them in constrained environments. Establish guidelines that prohibit eval-like constructs in analysis tooling and back these with automated checks in development and CI.

Find out what's already
exploitable in your codebase.