Executive brief
Grav is a popular flat-file content management system. Versions before 2.0.15 contain a vulnerability in blueprint form validation that allows users with page editing or blueprint configuration permissions to invoke PHP functions and write arbitrary content to files on the web server, enabling remote code execution. An attacker with basic editor privileges can exploit this to inject malicious PHP code into web-accessible locations.
Technical details
The vulnerability exists in the Blueprint dynamic-data bare-function validation (system/src/Grav/Common/Data/Blueprint.php:514-536), which uses an incomplete denylist instead of a positive allowlist to gate which PHP functions can be invoked. The error_log function is not included in the denylist and can be called via a data directive with attacker-controlled parameters. By invoking error_log($message, 3, $destination) with a PHP payload as the message and a web-accessible file path as the destination, an attacker with page-edit or blueprint-config access can append arbitrary PHP code to files. The paramsContainDangerousCallable() validation only checks for dangerous callable strings in parameters, allowing literal strings (payloads) and file paths to pass. This is a Code Injection vulnerability (CWE-94) requiring authenticated access (page-edit or blueprint-config role) but no further user interaction, and affects Grav versions prior to 2.0.15.
Affected products
- Grav Grav < 2.0.15
Timeline
- 2026-08-18: disclosed
- 2026-08-18: patched: Patched in version 2.0.15