CVE-2026-54133: jmespath.php has CompilerRuntime code injection via unescaped function names
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.
Other sources
jmespath.php allows users to use JMESPath, software for declaratively specifying how to extract elements from a JSON document, in PHP applications with PHP data structures. Versions prior to 2.9.1 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. The issue is patched in 2.9.1 and later. As a workaround, 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.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
composer/mtdowling/jmespath.phpto a version that resolves this vulnerability.Fixed in 2.9.1 - Upgrade
Upgrade
mtdowling/jmespath.phpto a version that resolves this vulnerability.Fixed in 2.9.1 - Configuration
Disable JP_PHP_COMPILE and do not use JmesPath\CompilerRuntime with attacker-controlled JMESPath expressions.
JmesPath\CompilerRuntime JP_PHP_COMPILE = disabled - Configuration
Use the default AstRuntime for untrusted expressions (do not evaluate untrusted JMESPath expressions via JmesPath\CompilerRuntime with JP_PHP_COMPILE enabled).
JmesPath\search() runtime = AstRuntime
Event History
Frequently Asked Questions
What is the severity of CVE-2026-54133?
The severity of CVE-2026-54133 is critical, rated 9.8 on the CVSS scale.
How do I fix CVE-2026-54133?
To fix CVE-2026-54133, upgrade to jmespath.php version 2.9.1 or later.
What is the risk associated with CVE-2026-54133?
CVE-2026-54133 has a risk score of 86, indicating a significant potential impact.
What type of vulnerability is CVE-2026-54133?
CVE-2026-54133 is classified as a code injection vulnerability due to unescaped function names.
Which versions of jmespath.php are affected by CVE-2026-54133?
Versions of jmespath.php prior to 2.9.1 are affected by CVE-2026-54133.