Loading...
Skip to main content

CVE-2025-66297 — Vulnerability in getgrav/grav — CVE Details

HIGH

Grav vulnerable to Privilege Escalation and Authenticated Remote Code Execution via Twig Injection

Published December 2, 2025Updated September 10, 2026Source: osv

Summary

### Summary A user with admin panel access and permissions to create or edit pages in Grav CMS can enable Twig processing in the page frontmatter. By injecting malicious Twig expressions, the user can escalate their privileges to admin or execute arbitrary system commands via the scheduler API. This results in both Privilege Escalation (PE) and Remote Code Execution (RCE) vulnerabilities. ### Details Grav CMS allows Twig to be executed in page templates if enabled in admin panel (process: twig: true). A user with publisher/editor privileges, that can create or edit pages and enable twig processing, can thereby inject arbitrary code that will execute in the context of the page render. This enables exploitation of Grav internal APIs such as: - `grav.user.update()` and `grav.user.save()` for escalating the current user to super admin or admin - `grav.scheduler.addCommand()`, `grav.scheduler.save()` and `grav.scheduler.run()` for code execution The Twig sandbox is not enforced in this context, allowing full access to any backend PHP object and method in the `system/src/Grav/Common` directory. ### PoC #### Preconditions: - You must have access to a **non-admin** user with permission to create/edit pages (```admin.pages``` access) - For Privilege Escalation, you also have to be logged in to the site with the same user as the admin panel. #### Steps to reproduce Privilege Escalation: 1. Login into the non-admin page (default at `cms-url/login`). 2. Login to the admin panel, create or edit a page and set the Twig processing to true (Advanced -> Process: Twig: true). 3. Inject the following payload into the page content to escalate privileges: ``` {% set _ = grav.user.update({ 'access': { 'admin': { 'login': true, 'super': true } } }, {}) %} {% set _ = grav.user.save() %} ``` 4. Visit the edited/created page url. The logged in user is now admin. (*Note: For the changes to show, you need to log out of the admin panel and relogin).* #### Steps to reproduce Remote Code Execution: 1. Login to the admin panel, create or edit a page and set the Twig processing to true (Advanced -> Process: Twig: true). 2. Inject the following payload into the page content to execute commands: ``` {% set _ = grav.scheduler.addCommand('curl', ['http://localhost:8000']) %} {% set _ = grav.scheduler.save() %} {% set _ = grav.scheduler.run() %} ``` 3. Visit the page to trigger the execution. The system will issue a `curl` request. ### Impact This vulnerability allows: - Privilege Escalation from any user with page editing capabilities to full admin (super) access. - Remote Code Execution, as the attacker can run system arbitrary commands via the scheduler API. It affects any Grav CMS installation where users with lower privileges are allowed to create or edit pages and Twig processing is not globally disabled.

Advisory Timeline

  • First published December 2, 2025 (314 days ago).
  • Last revised September 10, 2026 — 282 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

Composer
Update getgrav/grav to 1.8.0-beta.27 or later
composer require "getgrav/grav:^1.8.0-beta.27"

After upgrading, run your dependency scanner again to confirm the vulnerability is resolved.

Affected Packages (1)

Affects 1 ecosystem: packagist (1).

PackageEcosystemAffectedFixed In
getgrav/grav
packagist
0.8.0, 0.9.0, 0.9.1, 0.9.10 (+313 more)1.8.0-beta.27

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 8.8 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
Low
User Interaction
None
Scope
—
Confidentiality
—
Integrity
—
Availability
—

CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:P

Frequently Asked Questions

What is CVE-2025-66297?
Grav vulnerable to Privilege Escalation and Authenticated Remote Code Execution via Twig Injection This vulnerability has been assigned a severity rating of HIGH (CVSS score: 8.8/10).
How do I check if my project is affected by CVE-2025-66297?
CVE-2025-66297 affects getgrav/grav. Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2025-66297 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
8.8

High exploitability or significant impact. Prioritize remediation within days.

Also Known As

GHSA-858q-77wx-hhx6

Related CVEs

  • CVE-2025-66844
    CRITICAL

    Grav may be vulnerable to SSRF attack via Twig Templates

  • CVE-2026-75827
    CRITICAL

    Grav: Blueprint dynamic-data bare-function branch is denylist-gated and omits error_log, giving arbitrary file write

  • CVE-2025-66294
    HIGH

    Grav is vulnerable to RCE via SSTI through Twig Sandbox Bypass

  • CVE-2026-42844
    HIGH

    Low-privileged Grav API users can create super-admin accounts via blueprint-upload

  • CVE-2026-69088
    HIGH

    Grav: Incomplete callable validation in blueprint dynamic fields allows arbitrary static method invocation and file disclosure

  • CVE-2026-42612
    HIGH

    Grav Vulnerable to Publisher-Level Stored XSS via Unquoted Event Attributes

  • CVE-2026-65608
    HIGH

    Grav: FlexDirectory::dynamicDataField() executes arbitrary callables from blueprint data with no validation

  • CVE-2025-66296
    HIGH

    Grav vulnerable to Privilege Escalation in Grav Admin: Missing Username Uniqueness Check Allows Admin Account Takeover

Check if you're affected

Scan your dependencies to see if this vulnerability affects your projects.

Scan Your Dependencies