GHSA-pcw8-m77r-2528: Input Validation

Published Aug 18, 2026
·
Updated

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 JPPHPCOMPILE 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 JPPHPCOMPILE is enabled. Applications are most likely to be affected when they explicitly instantiate JmesPath\CompilerRuntime, enable JPPHPCOMPILE 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 JPPHPCOMPILE 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.

Affected Software

1 affected componentFixes available
composer/mtdowling/jmespath.php<2.9.1
2.9.1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade composer/mtdowling/jmespath.php to a version that resolves this vulnerability.

    Fixed in 2.9.1
  2. Upgrade

    Upgrade mtdowling/jmespath.php to a version that resolves this vulnerability.

    Fixed in 2.9.1
  3. Configuration

    Disable JP_PHP_COMPILE (do not use JmesPath\CompilerRuntime with attacker-controlled JMESPath expressions) until you upgrade.

    JmesPath\\CompilerRuntime JP_PHP_COMPILE = disabled
  4. Configuration

    For untrusted JMESPath expressions, use the default AstRuntime (avoid evaluating untrusted expressions with JmesPath\CompilerRuntime / when JP_PHP_COMPILE is enabled).

    JmesPath\search() runtime = AstRuntime

Event History

Aug 18, 2026
Advisory Published
via GitHub·08:16 PM
Data Sourced
via GitHub·08:16 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Which application flows are realistically exposed?

Applications are exposed when attacker-controlled input is accepted directly or used to construct a JMESPath expression, and that expression is evaluated through JmesPath\CompilerRuntime. The same applies to JmesPath\search() when JP_PHP_COMPILE is enabled.

2

What does an attacker need to exploit this issue?

No authentication or user interaction is required in the described attack flow. An attacker needs control over all or part of a JMESPath expression and must be able to supply a crafted non-identifier value where the parser accepts a function callee.

3

Is every use of the library affected?

The issue depends on use of the compiler runtime or enabling JP_PHP_COMPILE for JmesPath\search(); the data does not indicate that ordinary non-compiled evaluation is affected. The compiled-expression cache directory is part of the vulnerable path because generated PHP is written there and then loaded.

4

What mitigation is available before patching?

If patching cannot happen immediately, prevent untrusted input from being used directly or indirectly to build JMESPath expressions, and avoid evaluating such expressions with JmesPath\CompilerRuntime or with JP_PHP_COMPILE enabled. Restricting expression construction to trusted, fixed expressions removes the described attacker-controlled compilation path.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203