/

CVE-2026-65008

Severity:

CRITICAL RISK

(9.8)

Arbitrary Code Execution (CWE-94) in Grav Blueprints

CVE-2026-65008

Deferred

Vulnerability type

Category:

Arbitrary Code Execution

CWE:

CWE-94

Impact:

Remote Code Execution

Severity:

CRITICAL RISK

(9.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

Grav 2.0.4 contains an issue in the Blueprint dynamic data handling that lets attacker-controlled callable strings be passed directly into call_user_func_array() with no allowlist.

An authenticated user with page editing permissions can embed a malicious callable in page frontmatter that then executes as the web-server user whenever the page is viewed, including by unauthenticated visitors.

Affected context

This vulnerability appears in Grav installations where:

  • The blueprint system processes dynamic data via Blueprint::dynamicData()
  • The form or related plugins route page frontmatter through this dynamic resolution path
  • Users with admin.pages or api.pages.write permissions can edit page content or metadata
  • PHP is configured to allow callable strings to be executed through call_user_func_array()

In such contexts, page frontmatter serves as a vehicle for attacker-controlled callable directives that are evaluated at request time.

Exploit preconditions

  • Attack surface: HTTP(S) interface of the Grav admin/API and public page rendering.
  • Required access: An authenticated account with admin.pages or api.pages.write capability to create or modify pages/frontmatter.
  • Trigger point: Any subsequent visit to the crafted page (by any user, including anonymous visitors) that causes the blueprint dynamic data resolution to evaluate the malicious callable.
  • Why exploitation is possible: The blueprint resolver accepts an arbitrary Class::method string and arguments from frontmatter and forwards them directly to call_user_func_array() without validating the target against an allowlist or restricting the callable context, enabling execution of unintended application or PHP code paths.

Why this happens

The core issue is an unvalidated dynamic function call, where blueprint "dynamic data" is implemented by taking a user-influenced Class::method string and parameters and sending them directly into call_user_func_array().

This pattern maps to CWE-94: Improper Control of Code Generation (or execution), because it allows external input to determine which code is invoked at runtime.

Rather than constraining dynamic blueprint callbacks to a fixed, well-defined set of safe handlers with strict argument validation, the implementation permits arbitrary callables to be invoked, effectively turning configuration/frontmatter into an execution control channel.

Potential impact

  • Remote execution of arbitrary PHP methods within the Grav application context
  • Full compromise of the Grav site, including modification or deletion of content
  • Access to sensitive configuration or secrets accessible to the web-server user
  • Pivoting to the underlying server via local file access, process interaction, or additional vulnerabilities
  • Defacement or deployment of backdoors that execute on every page visit

General mitigation guidance

Effective mitigation focuses on removing unbounded dynamic execution paths and strictly constraining blueprint-driven behavior:

  • Replace generic call_user_func_array() usage with an explicit allowlist of permitted blueprint handlers, mapping symbolic identifiers to internal methods.
  • Treat frontmatter and other declarative configuration as data only; disallow direct specification of Class::method callables from user-editable content.
  • Introduce strong validation that rejects unknown or unexpected directive names and enforces argument types and ranges.
  • Apply least-privilege principles to admin roles so that only trusted users can modify pages that influence dynamic behavior.
  • Where possible, separate execution logic from layout/metadata and ensure any dynamic resolution uses immutable, server-side registered callbacks instead of arbitrary callables.

How teams detect issues like this

Detection typically combines code-level review with runtime monitoring:

  • Static analysis: Search for call_user_func_array() or similar reflection/dynamic-call APIs where the callable comes from user-controlled or configuration sources, especially in blueprint, template, or frontmatter processing.
  • Code review: Flag patterns where page metadata or form definitions are allowed to specify Class::method or other callables without a central registry or allowlist; verify that all dynamic callback registries validate targets.
  • Policy enforcement: Establish guidelines that prohibit treating content/frontmatter as a source of executable callables; enforce these rules through automated checks in continuous integration.
  • Runtime observation: Monitor logs for unexpected or suspicious method invocations associated with blueprint evaluation and for anomalies in page rendering paths indicative of dynamic execution misuse.

Sources

SourceLink
github.comgithub.com/getgrav/grav/security/advisories/GHSA-fj2p-qj2f-74v5
vulncheck.comvulncheck.com/advisories/grav-before-remote-code-execution-via-blueprint-dynamicdata

Frequently asked

questions

Exploitation requires an authenticated user with page editing or write permissions to plant the malicious directive, but once in place, the payload runs whenever anyone accesses the affected page, so the execution path is triggered by ordinary visitors.

The attacker needs valid credentials with admin.pages or api.pages.write privileges or equivalent capability to modify page frontmatter that flows into the blueprint dynamic data mechanism.

The safest approach is to eliminate arbitrary callable execution from user-controlled data by introducing a restricted set of registered blueprint actions, validating all directive names and parameters, and routing dynamic behavior through these vetted handlers instead of generic call_user_func_array() calls.

Avoid designs where configuration, templates, or content can determine which code is executed; apply strict separation between data and executable logic, enforce allowlists for any dynamic callback system, and include automated checks for unsafe dynamic invocation patterns in your development lifecycle.

Find out what's already
exploitable in your codebase.