Escaping the Latte Sandbox with the PHP 8.5 Pipe Operator

The Latte sandbox had no rule for the new |> operator, so on PHP 8.5+ a sandboxed template could call any PHP function or reachable object method. CVSS 9.9, fixed in 3.1.10 and 3.0.28.

  • GHSA-9hh3-mgwh-gpj4
  • CVSS 9.9
  • CVE pending

At a glance

  • Package latte/latte (Composer)
  • Affected versions 3.1.0 – 3.1.9 · 3.0.24 – 3.0.27
  • Fixed in 3.1.10 · 3.0.28
  • Severity Critical · CVSS 3.1 9.9
  • CVSS 3.1 CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
  • Weakness CWE-94 · CWE-693 · CWE-863
  • Who is affected Applications that render templates from untrusted authors in the sandbox (setSandboxMode() or the {sandbox} tag) on PHP 8.5 or newer.
  • Advisory GHSA-9hh3-mgwh-gpj4
  • Credit NitroHex™ Security LLC (reporter)RONGEN WANGHAOBO HUANG

What we found

Latte's sandbox inspects the compiled template and routes every function and method call through the security policy. The compiler pass had no case for the pipe operator (|>) added in PHP 8.5, so it was copied into the compiled template unchecked:

{='whoami' |> 'shell_exec'}

On PHP 8.5, $a |> $b runs as $b($a) for any callable, so this template executes a shell command even though a direct call to shell_exec() is refused. Wrapping a function with Closure::fromCallable also lifts the one-argument limit, because the runtime check accepted every Closure.

Impact

Anyone allowed to edit sandboxed templates (in Latte's documentation, a client or an external coder) could run any PHP function or reachable object method in the application process, with any arguments. Applications that do not use the sandbox, or run PHP 8.4 or older, are not affected.

Fix

Upgrade to latte/latte 3.1.10 or 3.0.28. The pipe operator now goes through the same policy check as every other call, and a template can no longer obtain a Closure of a forbidden function.

composer update latte/latte

Disclosure

We reported the issue privately to the Nette maintainers with a proof of concept, a suggested fix and a workaround. The fix and the GitHub security advisory were published on 23 November 2026, crediting NitroHex™ Security LLC as the reporter. A CVE ID has been requested through the advisory.

All research