What we found
The sandbox refuses $this and variable variables, and every template refuses $GLOBALS. But $_GET, $_POST, $_COOKIE, $_FILES, $_SERVER, $_ENV, $_REQUEST and $_SESSION compiled exactly as written, even under the unchanged safe policy:
{$_ENV['DB_PASSWORD']} {$_COOKIE['PHPSESSID']} {do $_SESSION['role'] = 'admin'}
Our proof of concept ran a small app with a .env file and a native session. A tenant template read the database password, the viewer's session cookie and Authorization header, then set its own role to admin in $_SESSION, and on the next request the admin area opened.
Impact
Anyone allowed to edit sandboxed templates could read secrets kept in the environment or .env files, steal the HttpOnly session cookie and Authorization header of every visitor who views the page, and write session data that later code trusts.
Fix
Upgrade to latte/latte 3.1.10 or 3.0.28, which refuse the eight superglobals in sandboxed templates. Templates are recompiled automatically after the upgrade, so there is no need to clear the cache.
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.