Reading and Writing Superglobals from the Latte Sandbox

Sandboxed Latte templates could read $_ENV, $_SERVER and $_COOKIE and write $_SESSION, exposing secrets and visitors' session cookies. CVSS 8.1, fixed in 3.1.10 and 3.0.28.

  • GHSA-7395-733q-q47j
  • CVSS 8.1
  • CVE pending

At a glance

  • Package latte/latte (Composer)
  • Affected versions 3.1.0 – 3.1.9 · 3.0.0 – 3.0.27
  • Fixed in 3.1.10 · 3.0.28
  • Severity High · CVSS 3.1 8.1
  • CVSS 3.1 CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N
  • Weakness CWE-200 · CWE-693 · CWE-863
  • Who is affected Applications that render templates from untrusted authors in the sandbox (setSandboxMode() or the {sandbox} tag), on any supported PHP version.
  • Advisory GHSA-7395-733q-q47j
  • Credit NitroHex™ Security LLC (reporter)RONGEN WANGHAOBO HUANG

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.

All research