---
id: CVE-2026-85604
title: >-
  Grav before 2.0.18 (affected versions <= 2.0.17) contains a remote code
  execution vulnerability in the Twig sort filter
summary: >-
  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/|re…
severity: high
cvss: 8.8
cvssVector: 'CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H'
cwe:
  - CWE-94
vendor: getgrav
product: grav
affected:
  - grav < 2.0.18
published: '2026-09-04'
updated: '2026-09-08'
sourceUpdated: '2026-09-08T20:05:53.177'
source: NVD
sourceUrl: 'https://nvd.nist.gov/vuln/detail/CVE-2026-85604'
references:
  - url: 'https://github.com/getgrav/grav/security/advisories/GHSA-p6qj-p5m7-f62h'
    label: disclosure@vulncheck.com
  - url: >-
      https://www.vulncheck.com/advisories/grav-before-2.0.19-remote-code-execution-via-sort-filter
    label: disclosure@vulncheck.com
  - url: 'https://github.com/getgrav/grav/security/advisories/GHSA-p6qj-p5m7-f62h'
    label: 134c704f-9b21-4f2e-91b3-4a467353bcc0
tags:
  - nvd
  - cve.org
  - exploit-available
exploitAvailable: true
ssvc:
  exploitation: poc
  automatable: 'no'
  technicalImpact: total
  timestamp: '2026-09-08T16:26:03.168009Z'
epss: 0.00477
epssPercentile: 0.40377
ingestedAt: '2026-09-06T01:47:58.491Z'
---

## Overview

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.

## Remediation

Refer to the linked advisories for vendor-supplied fixes and affected version ranges.
