CVE-2026-61450: Grav Twig Sandbox Bypass Exposes Configuration Secrets
Grav, a flat-file CMS, contains a sandbox escape vulnerability in its Twig templating system that allows page authors to read sensitive configuration data they should not access. An attacker with the ability to create or edit pages can use allowed Twig filters to dump the raw configuration object, exposing secrets such as SMTP passwords, API keys, and database credentials. This affects Grav versions before 2.0.2 and represents an incomplete patch of a previously identified sandbox bypass.
Source data · NVD / CISA · public domain
- CVSS
- 3.1 · 6.5 MEDIUM · CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
- Weaknesses (CWE)
- CWE-94
- Affected products
- 0 configuration(s)
- Published / Modified
- 2026-07-10 / 2026-07-10
NVD description (verbatim)
Grav before 2.0.2 contains a Twig sandbox bypass that allows a page author (any admin.pages user, or anyone able to write to user/pages) to exfiltrate configuration secrets. Although the sandbox replaces the 'config' variable with a redacted facade and strips Config::get/toArray from the method allowlist, the raw container remains accessible via the allow-listed grav.offsetGet('config'), which returns the real Config object. Allow-listed object-dumping filters (json_encode, print_r, yaml_encode) then serialize that object at the PHP level without invoking the sandbox method gate, exposing the full config tree including plugin secrets such as SMTP credentials, API keys, and plugin DB credentials. This is an incomplete fix for GHSA-j274-39qw-32c9.
3 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
CVE-2026-61450 is a Twig sandbox bypass in Grav's template rendering layer. The vulnerability stems from an incomplete implementation of the sandbox security model. Although the Grav developers replaced the 'config' variable with a redacted facade and removed Config::get and Config::toArray from the method allowlist, the underlying container remains accessible via the allow-listed grav.offsetGet('config') call. This call returns the unredacted Config object. Subsequently, allow-listed object-serialization filters—json_encode, print_r, and yaml_encode—serialize that Config object at the PHP object level rather than through the sandbox's method gate, bypassing sandbox restrictions and exposing the full configuration tree. CWE-94 (Code Injection) is the primary classification, though this manifests as template-level code injection enabling information disclosure.
Business impact
An authenticated page author can extract secrets from the Grav configuration without direct file system access. In multi-tenant or shared-hosting environments, this is especially critical: a low-privileged user with page-editing rights can harvest SMTP credentials, third-party API keys, and database connection strings. These credentials can then be used for lateral movement, credential stuffing, or unauthorized access to external services. The confidentiality impact is high, though integrity and availability of the Grav instance itself remain unaffected.
Affected systems
Grav versions before 2.0.2 are affected. Any Grav installation where untrusted users hold the admin.pages role (page creation/editing permission) or can write directly to the user/pages directory is at risk. This includes Grav sites with multiple content contributors, community-driven wikis, or hosted Grav environments that offer page-editing as a service.
Exploitability
Exploitability is straightforward for anyone with page-authoring permissions. No special tooling is required—the attack is executed through standard Twig template syntax. An attacker could embed the payload in a page body or a reusable Twig component, and the malicious code executes at page render time. The barrier to entry is low: the attacker need only understand Twig syntax and have valid credentials. However, the vulnerability requires authentication; unauthenticated remote exploitation is not possible.
Remediation
Upgrade to Grav 2.0.2 or later. This version fully addresses the sandbox bypass by preventing access to the raw config object via the container's offsetGet method and ensuring that object serialization respects sandbox restrictions. After upgrading, review access logs for any suspicious page creation or modification activity, and rotate secrets (SMTP passwords, API keys, database credentials) that were exposed during the window of vulnerability.
Patch guidance
Administrators should prioritize patching to Grav 2.0.2 or newer. The patch corrects the incomplete sandbox fix from the previous disclosure (GHSA-j274-39qw-32c9) by closing the remaining attack surface. Before patching, audit who holds page-editing privileges and consider temporarily restricting permissions if the vulnerability window was lengthy. After patching, test any custom Twig templates or plugins to ensure they do not rely on undocumented access patterns that may have been revoked.
Detection guidance
Monitor Grav server logs for page creation and modification events, particularly by low-privileged users. Look for pages containing Twig code using json_encode(), print_r(), or yaml_encode() on the grav variable or its offsetGet('config') result. Search the database or file system for pages recently modified that include suspicious Twig filters applied to config-related variables. Network-level detection is difficult unless the exfiltrated secrets are used in subsequent outbound connections; focus on application-level anomalies.
Why prioritize this
Although the CVSS score is 6.5 (MEDIUM), this vulnerability merits rapid patching due to the nature of the secrets exposed. SMTP and API credentials directly enable lateral movement and supply-chain attacks. In environments with strict privilege separation or multi-tenancy, this is a critical integrity risk. The incomplete prior patch suggests vendor confidence may be limited, making timely upgrade prudent to avoid further disclosure or variant bypasses.
Risk score, explained
The CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N score of 6.5 reflects high confidentiality impact but requires prior authentication (PR:L). The attack vector is network-accessible and requires no user interaction, but the prerequisite—valid page-editing credentials—limits the pool of potential attackers. The unchanged impact scope (S:U) means the vulnerability does not cross privilege boundaries in the Grav system itself, yet the data exposed can enable escalation outside Grav.
Frequently asked questions
Does this vulnerability allow unauthenticated access to secrets?
No. The attacker must possess valid credentials with the admin.pages role (or direct write access to user/pages). However, if an environment grants page-editing to many users or uses weak password policies, the 'authentication' barrier is less meaningful.
Is this the same vulnerability as GHSA-j274-39qw-32c9?
No, this is a bypass of the incomplete fix for GHSA-j274-39qw-32c9. The original patch attempted to sandbox the config variable but left the raw object accessible via a different method (grav.offsetGet('config')). Version 2.0.2 closes that remaining gap.
What secrets are at risk?
Any configuration variable stored in Grav's config tree can be exfiltrated, including SMTP credentials, API keys for external services (payment processors, email delivery, etc.), database connection strings, plugin secrets, and encryption keys. The exact exposure depends on what secrets the site operator has stored in configuration.
Can I mitigate this without upgrading immediately?
Partially. Restrict the admin.pages role to trusted staff only, disable or revoke page-editing for external contributors, and audit recent page modifications for suspicious Twig code. However, these are temporary measures; patching is essential for complete remediation.
This analysis is based on the published CVE record and vendor advisory details available as of the publication date. Consult the official Grav security advisory and release notes for definitive patch information and any additional context. SEC.co makes no warranty regarding the completeness or currency of this intelligence; always verify patch versions and compatibility in your environment before deploying updates. Proof-of-concept code or exploitation details are not provided herein; responsible disclosure practices should be observed by researchers. Source: NVD (public-domain), retrieved 2026-08-17. Analysis generated by SEC.co (claude-haiku-4-5).
Weaknesses (CWE)
Related vulnerabilities
- CVE-2026-0414MEDIUMNETGEAR RBE970 Admin Input Validation Flaw
- CVE-2026-10153MEDIUMCross-Site Scripting in westboy CicadasCMS Search Function
- CVE-2026-10173MEDIUMCross-Site Scripting in Orthanc Explorer 2 – Patch Guidance & Detection
- CVE-2026-10175MEDIUMCode Injection in Aider-AI Aider 0.86.3 – Exploit Available
- CVE-2026-10289MEDIUMXSS Vulnerability in Hotel and Tourism Reservation System 1.0
- CVE-2026-10301MEDIUMReflected XSS in itsourcecode Fees Management System 1.0 – Exploit Public
- CVE-2026-10688MEDIUMCode Injection in ahujasid blender-mcp
- CVE-2026-10810MEDIUMCross-Site Scripting in itsourcecode Fees Management System v1.0