/

CVE-2026-72824

Severity:

HIGH RISK

(8.8)

Improper Authorization (CWE-862) in Grav API Plugin Flaw

CVE-2026-72824

Deferred

Vulnerability type

Category:

Improper Authorization

CWE:

CWE-862

Impact:

Server-Side Template Injection and Remote Code Execution

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 scope-validation flaw in the Grav API plugin allows a narrowly scoped API key to bypass authorization checks for Twig processing when the key was created on a super-account context. Under specific Twig configuration settings, saving a page may enable server-side template execution, potentially resulting in remote code execution.

Affected context

The vulnerability occurs in the Grav API plugin's page-saving authorization flow, specifically where Twig content processing is guarded by a super-administrator check rather than the API key's declared scopes. It is relevant when a least-privilege key is minted on a super-account context, Twig content processing is enabled, and editor-based Twig controls are disabled. Plugin releases before the corrected release may be affected.

Exploit preconditions

  • Attack surface: Grav API page-writing functionality
  • Required access: A valid API key with page-write permission, such as api.pages.write
  • Account condition: The key must be associated with a super-account context whose administrative status is accepted by the guard
  • Trigger point: A page save that reaches the Twig-content processing authorization check
  • Configuration condition: security.twig_content.process_enabled=true and editor_enabled=false
  • Why exploitation is possible: The authorization path relies on a bare isSuperAdmin() check and does not consistently enforce the API key's api_key_scopes, allowing access beyond the key's intended privilege boundary

Why this happens

The underlying defect is an authorization-scope enforcement failure mapped to CWE-862: Missing Authorization. The page controller checks whether the associated account is a super administrator but fails to verify whether the API key itself has the separate scope required to enable Twig processing. This confuses account-level authority with delegated token authority, permitting a lower-privilege credential to invoke functionality intentionally excluded from its scope. If attacker-controlled or attacker-influenced page content is subsequently processed as Twig, the authorization bypass can become server-side template injection.

Potential impact

  • Server-side template injection may occur during page processing.
  • Arbitrary server-side code execution could result.
  • The Grav application and its stored content may be compromised.
  • Confidential data accessible to the application process could be exposed.
  • The host environment may be affected according to the application's runtime privileges.
  • Attackers could modify content or use the application as a foothold for further activity.

General mitigation guidance

Mitigation generally focuses on enforcing authorization at the API-key scope boundary rather than relying only on the privileges of the account that minted the key.

Defensive patterns include:

  • Require the specific administrative scope for any operation that enables or processes Twig content.
  • Evaluate token scopes independently from account-level administrator status.
  • Apply deny-by-default authorization for sensitive content-processing features.
  • Keep server-side template processing disabled unless it is explicitly required and tightly governed.
  • Separate content editing permissions from template execution permissions.
  • Run the application with least-privilege operating-system and service-account permissions.
  • Add authorization tests covering super-account-issued keys with restricted scopes.

How teams detect issues like this

Detection can combine code review, automated analysis, and runtime policy checks.

  • Search for authorization branches that use account or role checks without validating delegated token scopes.
  • Review controller methods that process page content or toggle template features for missing scope checks.
  • Flag security-sensitive operations gated only by isSuperAdmin() or equivalent identity checks.
  • Add tests that verify restricted API keys cannot invoke administrative functionality merely because their issuing account is privileged.
  • Monitor API activity for page-write requests followed by changes to template-processing settings or unusual server-side template errors.
  • Use automated code-review or static-analysis tools to identify inconsistent authorization checks across related endpoints.

Sources

SourceLink
github.comgithub.com/getgrav/grav/security/advisories/GHSA-96xv-p87j-58mx
vulncheck.comvulncheck.com/advisories/grav-before-api-key-scope-bypass-via-pagescontroller

Frequently asked

questions

It may be exploitable through the Grav API when an attacker possesses a qualifying page-write API key and the relevant Twig configuration conditions are enabled. The exact exposure depends on how API keys and content permissions are provisioned.

Not necessarily. The key requirement is access to a restricted API key associated with a super-account context; the vulnerability is that the key's narrower scopes are not fully respected.

Enforce the required API-key scope for Twig-related operations independently of the account's administrator status, and keep template processing disabled unless it is explicitly needed.

Treat delegated credentials as their own security principal, test every sensitive endpoint against reduced scopes, use deny-by-default authorization, and separate content editing from server-side template execution.

Find out what's already
exploitable in your codebase.