Skip to content

jmespath.php has CompilerRuntime code injection via unescaped function names

Critical severity GitHub Reviewed Published Jun 11, 2026 in jmespath/jmespath.php • Updated Aug 18, 2026

Package

composer mtdowling/jmespath.php (Composer)

Affected versions

< 2.9.1

Patched versions

2.9.1

Description

Impact

mtdowling/jmespath.php can generate and execute attacker-controlled PHP code when JmesPath\CompilerRuntime is used with an attacker-controlled JMESPath expression. The compiler emits parsed JMESPath function names into generated PHP source without sufficient escaping. A crafted expression can cause the generated cache file to contain executable attacker-controlled PHP, which is then loaded by the compiler runtime.

A vulnerable flow is:

  1. An application accepts or constructs a JMESPath expression using attacker-controlled input.
  2. The expression is evaluated with JmesPath\CompilerRuntime, or with JmesPath\search() while JP_PHP_COMPILE is enabled.
  3. The crafted expression uses a non-identifier value where the parser accepts a function callee.
  4. The compiler writes that value into generated PHP source without safely escaping it as a PHP string literal.
  5. The generated source is written to the compiled-expression cache directory.
  6. CompilerRuntime loads the generated cache file.
  7. The injected PHP executes in the context of the affected application.

In that flow, an attacker can execute arbitrary PHP code with the privileges of the PHP process. The searched data document is not sufficient to exploit this issue by itself; the attacker must be able to influence the JMESPath expression string.

The default runtime used by JmesPath\search() is AstRuntime, which interprets the parsed expression tree and is not affected unless JP_PHP_COMPILE is enabled. Applications are most likely to be affected when they explicitly instantiate JmesPath\CompilerRuntime, enable JP_PHP_COMPILE as a performance optimization, and allow users to provide JMESPath expressions for filtering, querying, or transforming data.

Patches

The issue is patched in 2.9.1 and later.

Workarounds

If you cannot upgrade immediately, disable JP_PHP_COMPILE and do not use JmesPath\CompilerRuntime with attacker-controlled expressions. Use the default AstRuntime for untrusted expressions. Applications that must continue accepting untrusted JMESPath expressions before upgrading should ensure those expressions are never evaluated by the compiler runtime.

References

@GrahamCampbell GrahamCampbell published to jmespath/jmespath.php Jun 11, 2026
Published by the National Vulnerability Database Jun 12, 2026
Published to the GitHub Advisory Database Aug 18, 2026
Reviewed Aug 18, 2026
Last updated Aug 18, 2026

Severity

Critical

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

EPSS score

Exploit Prediction Scoring System (EPSS)

This score estimates the probability of this vulnerability being exploited within the next 30 days. Data provided by FIRST.
(25th percentile)

Weaknesses

Improper Input Validation

The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. Learn more on MITRE.

Improper Control of Generation of Code ('Code Injection')

The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. Learn more on MITRE.

Improper Encoding or Escaping of Output

The product prepares a structured message for communication with another component, but encoding or escaping of the data is either missing or done incorrectly. As a result, the intended structure of the message is not preserved. Learn more on MITRE.

CVE ID

CVE-2026-54133

GHSA ID

GHSA-pcw8-m77r-2528

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.