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.