/

CVE-2026-75827

Severity:

HIGH RISK

(8.8)

PHP Code Injection (CWE-94) in Grav Blueprint System

CVE-2026-75827

Deferred

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

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

Grav contains a PHP code injection vulnerability in Blueprint dynamic-data validation, where an incomplete denylist permits access to a file-writing function. An attacker with page-edit or blueprint-configuration access may append PHP code to a web-accessible file and achieve remote code execution.

Affected context

The vulnerability occurs in Grav deployments that use Blueprint dynamic-data processing and allow users to edit pages or blueprint configuration. It becomes risky when the validation logic relies on a denylist that does not prevent invocation of file-writing functionality, and the application can write to files reachable by the web server.

Exploit preconditions

  • Attack surface: Grav page-editing and blueprint-configuration functionality
  • Required access: Page-edit or blueprint-config privileges
  • Trigger point: Processing a Blueprint dynamic-data directive
  • Why exploitation is possible: Incomplete function validation permits a file-writing operation that can append attacker-controlled PHP content to a web-accessible file

Why this happens

The underlying bug is an unsafe function-validation design in which a denylist attempts to block dangerous functions without comprehensively defining permitted behavior. Because a file-writing function remains callable through dynamic data, an authorized but potentially untrusted user can influence server-side files. This maps to CWE-94: Improper Control of Generation of Code, because attacker-controlled input can be written into a location where the application or web server may later interpret it as executable PHP code.

Potential impact

  • Attackers may execute arbitrary PHP code with the privileges of the web server
  • The Grav installation could be fully compromised
  • Sensitive application data and configuration may be exposed
  • Attackers could alter content, plant persistence, or tamper with site behavior
  • The host or connected services could experience further compromise

General mitigation guidance

Mitigation generally centers on replacing denylist-based dynamic function validation with a positive allowlist of narrowly defined, non-destructive operations.

Common defensive patterns include:

  • Permit only explicitly approved functions and data types
  • Eliminate dynamic execution and file-writing capabilities from user-controlled directives
  • Separate content-editing privileges from blueprint and system-configuration privileges
  • Prevent the web process from writing to web-accessible executable directories
  • Store user-controlled content outside executable paths where feasible
  • Apply least-privilege permissions to the application, filesystem, and hosting environment
  • Enforce strict input schemas and authorization checks before processing dynamic data

How teams detect issues like this

Detection approaches may include:

  • Static analysis rules for dynamic function dispatch, denylist-based validation, and file-writing APIs used with user-controlled data
  • Code review checks for Blueprint directives that can invoke filesystem or execution-related functions
  • Monitoring for unexpected changes or appended content in web-accessible PHP files
  • File-integrity monitoring on application directories and configuration paths
  • Web and application logs showing unusual page-edit or blueprint-configuration activity
  • Policy enforcement that blocks application processes from writing executable files in served directories
  • Automated security review tools that flag dangerous sinks reached from administrative input

Sources

SourceLink
github.comgithub.com/getgrav/grav/security/advisories/GHSA-f8wv-xp27-6gq7
vulncheck.comvulncheck.com/advisories/grav-before-arbitrary-file-write-via-error-log

Frequently asked

questions

It can be exploited through Grav's web-based management functionality when the attacker has the required page-edit or blueprint-configuration access. It is not generally an unauthenticated issue.

The attacker needs permissions that allow editing pages or changing blueprint configuration, along with the ability to trigger Blueprint dynamic-data processing.

Replace denylist-based function filtering with a strict positive allowlist, remove file-writing capabilities from user-controlled directives, and ensure served files cannot be modified by the web process.

Minimize dynamic behavior in configuration systems, enforce least privilege, validate inputs against explicit schemas, review dangerous filesystem sinks, and monitor executable web content for unexpected changes.

Find out what's already
exploitable in your codebase.