Junglewise Threat Intelligence

Grav CMS Twig sandbox bypass in configuration variables

Severity: medium · CVSS 6.5 · Published 2026-08-25

Executive brief

Grav CMS is a flat-file content management system used to build websites without a database. A vulnerability in its template sandbox allows content editors to read sensitive configuration values—including database credentials, cache passwords, and API keys—by directly accessing configuration arrays in Twig templates, bypassing the intended access restrictions. This affects any Grav installation where users have page-content editing privileges.

Technical details

The vulnerability is an information-disclosure flaw in the Twig template sandbox implementation. Grav's Twig::init() method unconditionally exposes raw system, site, and theme configuration arrays into the template context, and processPage() copies these unfiltered into sandboxed renders. Although a filtered config facade is substituted, the system, site, and theme arrays bypass the sandbox entirely since Twig's SecurityPolicy only gates method/property access on objects—not array subscript or dot notation access. An attacker with page-content edit access can use Twig expressions like {{ system.cache.redis.password }} to read nested secret values, completely bypassing config_denied_paths restrictions. No patch is available as of the advisory date; the vulnerability was fixed in version 2.0.16 (though this advisory is marked withdrawn as a duplicate).

Affected products

  • Grav Grav CMS < 2.0.16

Timeline

  • 2026-08-25: disclosed
  • 2026-08-25: advisory
  • 2026-08-10: patched: Version 2.0.16 patched the primary advisory GHSA-p597-crqc-m349

References

Related threats