/

CVE-2026-130741

Severity:

HIGH RISK

(8.8)

Information Disclosure (CWE-200) in Grav Twig Sandbox

CVE-2026-130741

Deferred

Vulnerability type

Category:

Information Disclosure

CWE:

CWE-200

Impact:

Sensitive file disclosure and potential privilege escalation

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A Twig sandbox bypass in Grav can let publishers access sensitive server files by misusing allowlisted functions and page accessor setters during rendering. Exposed private keys or API signing secrets could be used to forge a super-admin API token.

Affected context

The issue affects Grav deployments where publisher-controlled content is rendered through the Twig sandbox and the sandbox exposes the relevant allowlisted function and page accessors. In that context, page objects or asset collections may be manipulated to expose files and secrets that should not be available to publishers.

Exploit preconditions

  • Attack surface: Twig-rendered content in a Grav deployment
  • Required access: Publisher-level ability to influence content that is rendered
  • Trigger point: Rendering content that can access the affected functions and page setters
  • Why exploitation is possible: The sandbox's allowed operations can be combined to redirect page or asset references to sensitive files and expose their contents

Why this happens

The sandbox permits a combination of allowlisted function access and page accessor setters that can be used beyond their intended boundaries. This weakens the separation between publisher-controlled templates and server-side files, resulting in exposure of confidential data. The described impact maps to CWE-200: Exposure of Sensitive Information to an Unauthorized Actor.

Potential impact

  • Publishers may be able to read private keys or other sensitive server files.
  • API signing secrets could be exposed.
  • An attacker could potentially forge a super-admin API token using a disclosed signing secret.
  • Unauthorized administrative access or further compromise may result.

General mitigation guidance

Mitigation patterns include narrowing the sandbox to a minimal, explicit set of safe operations and avoiding accessors or helpers that can redirect references to server resources. Treat publisher-authored content as untrusted, constrain file access to intended locations, and keep signing secrets outside content-rendering contexts. Apply least privilege to the runtime and limit the authority of credentials available to it.

How teams detect issues like this

Review sandbox configuration and template-facing APIs for allowlisted functions or setters that can affect file paths, page objects, or asset collections. Static analysis and code review can flag broad helper exposure, mutable resource references, and file access reachable from untrusted templates. Policy checks can require explicit sandbox allowlists and prevent secrets from being placed in render-accessible paths; automated review tools may help identify risky patterns.

Sources

SourceLink
github.comgithub.com/getgrav/grav/security/advisories/GHSA-8rhf-56h6-j77w

Frequently asked

questions

The described attack requires publisher-level influence over content that is rendered through the affected Twig sandbox.

Direct server access is not specified as a prerequisite. The key condition is the ability to influence rendered content; the resulting exposure depends on the deployment and content access controls.

Keep the sandbox allowlist minimal and avoid exposing template operations that can redirect page or asset references to arbitrary server files.

Treat publisher-controlled content as untrusted, isolate secrets from rendering contexts, constrain file access, and review template-facing APIs for unsafe combinations of capabilities.

Find out what's already
exploitable in your codebase.