module

Grav CMS Twig SSTI Authenticated Sandbox Bypass RCE

Disclosed
Dec 1, 2025
Created
Dec 12, 2025

Description

This module exploits a Server-Side Template Injection (SSTI)
vulnerability (CVE-2025-66294) in Grav CMS that allows bypassing the
Twig sandbox to achieve remote code execution. The cleanDangerousTwig
method uses weak regex that fails to sanitize nested Twig calls within
the evaluate_twig function. To inject the payload, this module leverages
CVE-2025-66301, a broken access control flaw that allows users with page
editing privileges to modify the form's YAML frontmatter process section.

Author

Tarek Nakkouch

Platform

Linux,Unix,Windows

Architectures

cmd

Module Options

To display the available options, load the module within the Metasploit console and run the commands 'show options' or 'show advanced':


msf > use exploit/multi/http/grav_twig_ssti_sandbox_bypass_rce
msf exploit(grav_twig_ssti_sandbox_bypass_rce) > show targets
...targets...
msf exploit(grav_twig_ssti_sandbox_bypass_rce) > set TARGET < target-id >
msf exploit(grav_twig_ssti_sandbox_bypass_rce) > show options
...show and set options...
msf exploit(grav_twig_ssti_sandbox_bypass_rce) > exploit

Title
NEW

Explore Exposure Command

Confidently identify and prioritize exposures from endpoint to cloud with full attack surface visibility and threat-aware risk context.