☠️
EXFILTRATING
DATA...
01010111 10110010 00101001 11000110 01101100 10011011 00010001 11100101 01000010 10101111
[ <-- BACK_TO_SEARCH ]
Getgrav logo [ WEBSITE ] [ VENDOR STATS ]
CVSS: 8.8 CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H 🐛 CWE-1336
👁️
Common Weakness Enumeration - Identifies the specific category of software weakness or flaw.

CVE-2025-66297

CVE-2025-66297 Remote Code Execution in Grav
📅 PUBLISHED: 2025-12-01 21:05 UTC 🔄 UPDATED: 2026-10-09 10:28 UTC
[ PATCH UNDER REVIEW ↓ ] Remains UNDER REVIEW until an independent source confirms the fix
[ DEFENSE PATCH ↓ ]
💣 PoC: Public
👁️
Proof of Concept - Indicates if functional exploit code is publicly available, drastically increasing the risk of immediate attacks.
🎯 EPSS: 0.78%
👁️
0.78% probability
19.6× above the median CVE
Tier: ELEVATED
30-day exploitation window · FIRST.org · updated daily
Country: Global License: Open Source
VULNERABLE: version not auto-detected — verify your deployed version locally
CVSS VECTOR BREAKDOWN 8.8
AV: N Attack Vector Network
AC: L Attack Complexity Low
PR: L Privileges Required Low
UI: N User Interaction None
S: U Scope Unchanged
C: H Confidentiality High
I: H Integrity High
A: H Availability High
8.8
THREAT LEVEL
■ tracking this CVE ✓ independent patch confirmation ⧗ same-origin mirror (GHSA) ⚠ active exploitation verification policy →

Executive Summary

CVE-2025-66297 is a critical vulnerability in Grav CMS, a file-based web platform. The flaw allows an authenticated user with permissions to create or edit pages to inject malicious Twig expressions into page frontmatter. This enables privilege escalation to admin level and remote code execution (RCE) via the scheduler API. The vulnerability is fixed in version 1.8.0-beta.27. No public proof-of-concept code or exploit templates are currently available, but the risk is high due to the potential for full system compromise.

⚡ AUTOMATE YOUR CVE INTELLIGENCE

This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.

›Patch confidence — UNVERIFIED to CONFIRMED, cross-referenced NVD + RHSA + Debian
›Exploit & PoC — poc_status, poc_url, has_exploit. Not in NVD.
›Shodan dorks — ready-made queries to find exposed vulnerable systems
›Detection rules — YARA · Wazuh · Elastic (all plans) · Sigma (Pro)
›pending_fields — know exactly which of 7 fields NVD hasn't processed yet
›Free backfill — data incomplete when you paid? Re-check within 30 days = 0 credits
PAYG €0.08/lookup Standard €19/mo (was €29) · 5k credits Pro €65/mo (was €99) · 20k credits FOUNDING PRICE · LOCKED FOR LIFE · ENDS 31 DEC 2026
[ FROM €19/MO ]
Free sandbox key available
No signup required

Supply Chain & Package Security

Grav CMS is a PHP-based application distributed via its official website and GitHub. The vulnerability is not in a package manager (NPM, PyPI, Go, Ruby) but in the core application logic. Users should verify the integrity of their Grav installation and ensure they are using the patched version.

CVSS Breakdown & Threat Level

  • CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H
  • Base Score: 7.2 (High)
  • Attack Vector: Network
  • Attack Complexity: Low
  • Privileges Required: High (admin panel access with page creation/edit permissions)
  • User Interaction: None
  • Scope: Unchanged
  • Confidentiality Impact: High
  • Integrity Impact: High
  • Availability Impact: High

The high privileges required reduce the base score, but the impact is severe as it allows full system compromise.

Deep Dive & Mechanics

Grav CMS uses Twig as its templating engine. Page frontmatter (YAML metadata) can be processed by Twig if the twig_first option is enabled. In vulnerable versions, a user with page creation/edit permissions can set twig_first: true in the frontmatter and inject malicious Twig expressions. These expressions are executed when the page is rendered.

The scheduler API in Grav allows execution of system commands. By combining Twig injection with the scheduler API, an attacker can execute arbitrary commands on the server. The attack flow is:

  1. Authenticate to the Grav admin panel with a user that has page creation/edit permissions.
  2. Create or edit a page and set twig_first: true in the frontmatter.
  3. Inject a Twig expression that calls the scheduler API to execute a system command (e.g., {{ grav.scheduler.execute('id') }}).
  4. Trigger the page rendering (e.g., by visiting the page or via a cron job).
  5. The command executes, leading to privilege escalation or RCE.

Vulnerable vs. Patched Code

Vulnerable Code (prior to 1.8.0-beta.27): In system/src/Grav/Common/Page/Page.php, the twig_first option is processed without restrictions:

if ($this->header()->get('twig_first')) {
    $this->content = $this->twig->processString($this->content, $this->twig->getPageVariables());
}

Patched Code (1.8.0-beta.27): The patch restricts twig_first to admin users only and sanitizes the input:

if ($this->header()->get('twig_first') && $this->config->get('system.pages.twig_first')) {
    $this->content = $this->twig->processString($this->content, $this->twig->getPageVariables());
}

Additionally, the scheduler API now requires admin-level authentication for command execution.

Exploitation & Lab Setup

Red Team

Prerequisites:

  • Access to Grav admin panel with a user that has page creation/edit permissions.
  • Target running Grav CMS version < 1.8.0-beta.27.

Exploitation Steps:

  1. Login to the admin panel.
  2. Create a new page or edit an existing one.
  3. Set the frontmatter to include:
    ---
    title: Exploit
    twig_first: true
    ---
    
  4. Inject malicious Twig in the page content:
    {{ grav.scheduler.execute('id') }}
    
  5. Save and view the page to trigger execution.

Expected Output: The id command output will be displayed on the page or logged.

Blue Team

Detection Steps:

  1. Monitor admin panel logs for unusual page creation or editing activity.
  2. Check page frontmatter for twig_first: true in non-admin pages.
  3. Review scheduler logs for unexpected command executions.
  4. Look for Twig syntax in page content that is not typical for the site.

Hunting Query: Search for pages with twig_first set to true in the database or file system:

grep -r "twig_first: true" /path/to/grav/user/pages/

Indicators of Compromise (IOCs)

  • File System: Presence of twig_first: true in page frontmatter files.
  • Logs: Scheduler API calls with unexpected commands in logs/grav.log.
  • Network: Outbound connections from the server to attacker-controlled hosts (if command execution leads to data exfiltration).
  • Process: Unusual processes spawned by the web server user (e.g., id, whoami, curl).

Detection Engineering

YARA Rule

rule CVE_2025_66297_Twig_Injection {
    meta:
        description = "Detects Twig injection in Grav CMS page files"
        author = "Valters IT"
        date = "2025-01-01"
        reference = "CVE-2025-66297"
    strings:
        $twig_first = "twig_first: true"
        $twig_exec = "{{ grav.scheduler.execute("
    condition:
        $twig_first and $twig_exec
}

Sigma Rule

title: Grav CMS Twig Injection via Scheduler API
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects exploitation of CVE-2025-66297 by monitoring scheduler API calls
author: Valters IT
date: 2025-01-01
logsource:
    category: webserver
    product: apache
detection:
    selection:
        cs-method: 'POST'
        c-uri: '/admin/scheduler/execute'
        cs-uri-query: '*'
    condition: selection
falsepositives:
    - Legitimate admin scheduler usage
level: high

Suricata Rule

alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2025-66297 Grav CMS Twig Injection"; flow:to_server,established; content:"POST"; http_method; content:"/admin/scheduler/execute"; http_uri; content:"command"; http_client_body; classtype:attempted-admin; sid:1000001; rev:1;)

Remediation & Mitigation

Immediate Actions:

  1. Upgrade to Grav CMS version 1.8.0-beta.27 or later.
  2. Restrict admin panel access to trusted users only.
  3. Disable twig_first in system configuration if not needed:
    system:
      pages:
        twig_first: false
    

Long-term Measures:

  • Implement strict input validation for page frontmatter.
  • Use Web Application Firewall (WAF) rules to block Twig syntax in page content.
  • Regularly audit user permissions and logs.

Valters IT – Securing your digital frontier.

💣 PoC CODE AVAILABLE

Exploit code for this CVE is tracked in our database. Access poc_code via API Pro.

[ API_PRO ] →
◈ SOURCE Analysis & enrichment: valtersit.com/cve/CVE-2025-66297/ · CVE data: NVD/MITRE (public domain) · © 2026 ValtersIT Hub
>_ SYSTEM_CORE: INTEL_ACTIVE
90% TEAM-CURATED // 10% AUTOMATED INGESTION.
ALL PATCH REFERENCES AND VERSION DATA SOURCED FROM NVD + OSV OFFICIAL REGISTRIES.