Description
Grav before 2.0.18 (affected versions <= 2.0.17) contains a remote code execution vulnerability in the Twig sort filter. The sortFunc wrapper in GravExtension.php hardcodes Twig's isSandboxed argument to false, so unlike |map/|filter/|reduce, |sort accepts a plain function name inside the sandbox; the remaining denylist misses spl_autoload, which performs a PHP include. An authenticated user with only page-write rights (admin.pages or api.pages.write) can supply a crafted payload (e.g., via form frontmatter rendered by the Email plugin) that invokes spl_autoload through the sort filter, resulting in arbitrary PHP execution as the web server user.
Published: 2026-09-04
Score: 8.7 High
EPSS: < 1% Very Low
KEV: No
Impact: Remote Code Execution
Action: Immediate Patch
AI Analysis

Impact

The vulnerability allows an attacker who has only page‑write rights to run arbitrary PHP code on the Grav CMS web server. In versions up to 2.0.17, the Twig sort filter’s wrapper ignores sandbox restrictions, permitting the use of plain function names such as spl_autoload. Because spl_autoload triggers a PHP include, an attacker can craft a payload – for example, via form front‑matter rendered by the Email plugin – that causes the filter to execute the supplied function, leading to full remote code execution as the web server user.

Affected Systems

The affected product is the Grav CMS. Versions up to and including 2.0.17 are impacted. The product vendor is getgrav, with the main product name Grav. Versions 2.0.18 and 2.0.19 or newer are not affected.

Risk and Exploitability

The CVSS score of 8.7 indicates high severity. No EPSS data is available, so the likelihood of exploitation cannot be quantified but the vulnerability requires an authenticated user with page‑write privileges, such as those granted the admin.pages or api.pages.write role. The exploit can be delivered through a crafted payload passed to the sort filter, for example via front‑matter in the Email plugin's form. The vulnerability is not currently listed in CISA's KEV catalog.

Generated by OpenCVE AI on September 5, 2026 at 11:26 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade Grav to version 2.0.19 or later.
  • If an immediate upgrade is not possible, remove or restrict the Email plugin or any custom templates that use the Twig sort filter with unsandboxed functions until the patch is applied.
  • Verify that page‑write permissions are only granted to trusted administrators to limit potential exploit opportunities.

Generated by OpenCVE AI on September 5, 2026 at 11:26 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Tue, 08 Sep 2026 17:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'total'}, 'version': '2.0.3'}


Sat, 05 Sep 2026 10:30:00 +0000

Type Values Removed Values Added
Description Grav before 2.0.19 (affected versions <= 2.0.17) contains a remote code execution vulnerability in the Twig sort filter. The sortFunc wrapper in GravExtension.php hardcodes Twig's isSandboxed argument to false, so unlike |map/|filter/|reduce, |sort accepts a plain function name inside the sandbox; the remaining denylist misses spl_autoload, which performs a PHP include. An authenticated user with only page-write rights (admin.pages or api.pages.write) can supply a crafted payload (e.g., via form frontmatter rendered by the Email plugin) that invokes spl_autoload through the sort filter, resulting in arbitrary PHP execution as the web server user. Grav before 2.0.18 (affected versions <= 2.0.17) contains a remote code execution vulnerability in the Twig sort filter. The sortFunc wrapper in GravExtension.php hardcodes Twig's isSandboxed argument to false, so unlike |map/|filter/|reduce, |sort accepts a plain function name inside the sandbox; the remaining denylist misses spl_autoload, which performs a PHP include. An authenticated user with only page-write rights (admin.pages or api.pages.write) can supply a crafted payload (e.g., via form frontmatter rendered by the Email plugin) that invokes spl_autoload through the sort filter, resulting in arbitrary PHP execution as the web server user.
Title Grav before 2.0.19 Remote Code Execution via sort filter Grav before 2.0.18 Remote Code Execution via sort filter

Fri, 04 Sep 2026 11:45:00 +0000

Type Values Removed Values Added
Description Grav before 2.0.19 (affected versions <= 2.0.17) contains a remote code execution vulnerability in the Twig sort filter. The sortFunc wrapper in GravExtension.php hardcodes Twig's isSandboxed argument to false, so unlike |map/|filter/|reduce, |sort accepts a plain function name inside the sandbox; the remaining denylist misses spl_autoload, which performs a PHP include. An authenticated user with only page-write rights (admin.pages or api.pages.write) can supply a crafted payload (e.g., via form frontmatter rendered by the Email plugin) that invokes spl_autoload through the sort filter, resulting in arbitrary PHP execution as the web server user.
Title Grav before 2.0.19 Remote Code Execution via sort filter
First Time appeared Getgrav
Getgrav grav
Weaknesses CWE-94
CPEs cpe:2.3:a:getgrav:grav:*:*:*:*:*:*:*:*
Vendors & Products Getgrav
Getgrav grav
References
Metrics cvssV3_1

{'score': 8.8, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H'}

cvssV4_0

{'score': 8.7, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N'}


cve-icon MITRE

Status: PUBLISHED

Assigner: VulnCheck

Published:

Updated: 2026-09-08T16:28:18.434Z

Reserved: 2026-09-04T11:00:28.731Z

Link: CVE-2026-85604

cve-icon Vulnrichment

Updated: 2026-09-08T16:27:53.835Z

cve-icon NVD

Status : Deferred

Published: 2026-09-04T12:17:24.177

Modified: 2026-09-08T20:05:53.177

Link: CVE-2026-85604

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-09-05T11:30:05Z

Weaknesses
  • CWE-94

    Improper Control of Generation of Code ('Code Injection')