CVE-2026-85604: Improper Control of Generation of Code ('Code Injection') in getgrav grav
Description
Grav versions before 2.0.18 contain a remote code execution vulnerability in the Twig sort filter. This flaw allows an authenticated user with page-write permissions to execute arbitrary PHP code via a crafted payload exploiting the sortFunc wrapper's improper sandboxing. The vulnerability arises because the isSandboxed argument is hardcoded to false, enabling the use of dangerous functions like spl_autoload within the sandbox.
CVSS v4.0
Score 8.7high
Affected software
getgrav
grav
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
CVE-2026-85604 is a remote code execution vulnerability affecting Grav CMS versions prior to 2.0.18. The issue lies in the Twig sort filter implementation, where the sortFunc wrapper in GravExtension.php sets the isSandboxed argument to false. This improper sandboxing allows the sort filter to accept plain function names, unlike other filters such as map, filter, or reduce. The denylist used to restrict dangerous functions misses spl_autoload, which can perform PHP includes. An authenticated user with page-write rights (admin.pages or api.pages.write) can supply a crafted payload, for example through form frontmatter rendered by the Email plugin, to invoke spl_autoload and achieve arbitrary PHP code execution as the web server user.
Potential Impact
An attacker with authenticated page-write permissions can execute arbitrary PHP code on the server hosting Grav CMS. This can lead to full compromise of the web server environment under the web server user context. The vulnerability is high severity with a CVSS 4.0 score of 8.7, indicating a network attack vector with low complexity and no required privileges beyond page-write access.
Mitigation Recommendations
A fix is available in Grav version 2.0.18. Users should upgrade to version 2.0.18 or later to remediate this vulnerability. Until patched, restrict page-write permissions to trusted users only and avoid exposing the Email plugin or other input vectors that render user-supplied frontmatter.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- VulnCheck
- Date Reserved
- 2026-09-04T11:00:28.731Z
- Cvss Version
- 4.0
- State
- PUBLISHED
Threat ID: 6a9aada3acd9273b4981da31
Added to database: 09/04/2026, 11:38:11 UTC
Last enriched: 09/15/2026, 00:59:01 UTC
Last updated: 10/17/2026, 18:48:23 UTC
Views: 45
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.