9.8critical
jmespath.php has CompilerRuntime code injection via unescaped function names
- Severity
- 9.8critical CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.44% (higher than 40% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-pcw8-m77r-2528
Description
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 `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.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| jmespath jmespath.php | < 2.9.1 | CVE List |
| mtdowling/jmespath.php (Packagist) | before 2.9.1 | GitHub Advisory Database |
| jmespath jmespath | before 2.9.1 | NVD |
All scores
| GitHub_M | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| GitHub | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
Classification
What each source says
CVE List
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 `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.
GitHub Advisory Database
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:
- An application accepts or constructs a JMESPath expression using attacker-controlled input.
- The expression is evaluated with
JmesPath\CompilerRuntime, or withJmesPath\search()whileJP_PHP_COMPILEis enabled. - The crafted expression uses a non-identifier value where the parser accepts a function callee.
- The compiler writes that value into generated PHP source without safely escaping it as a PHP string literal.
- The generated source is written to the compiled-expression cache directory.
CompilerRuntimeloads the generated cache file.- 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.
NVD (es)
jmespath.php permite a los usuarios usar JMESPath, software para especificar declarativamente cómo extraer elementos de un documento JSON, en aplicaciones PHP con estructuras de datos PHP. Las versiones anteriores a la 2.9.1 pueden generar y ejecutar código PHP controlado por el atacante cuando se usa “JmesPath\CompilerRuntime” con una expresión JMESPath controlada por el atacante. El compilador emite nombres de funciones JMESPath analizados en el código fuente PHP generado sin suficiente escape. Una expresión manipulada puede hacer que el archivo de caché generado contenga PHP ejecutable controlado por el atacante, que luego es cargado por el tiempo de ejecución del compilador. El problema está parcheado en “2.9.1” y versiones posteriores. Como solución alternativa, deshabilite “JP_PHP_COMPILE” y no use “JmesPath\CompilerRuntime” con expresiones controladas por el atacante. Use el “AstRuntime” predeterminado para expresiones no confiables. Las aplicaciones que deben seguir aceptando expresiones JMESPath no confiables antes de la actualización deben asegurarse de que esas expresiones nunca sean evaluadas por el tiempo de ejecución del compilador.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-54133 changed 2026-06-12 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-pcw8-m77r-2528 changed 2026-08-18 | CC-BY-4.0 |
| NVD | CVE-2026-54133 changed 2026-10-25 | Public domain |