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.
Exploit database
Vulnerability
CVE-2025-66294
Grav is vulnerable to RCE via SSTI through Twig Sandbox Bypass
Vulnerability details
- Score
- 8.7
- Severity
- high
CVSS 4.0 · GitHub_M
Vector string
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:NDescription
Grav is a file-based Web platform. Prior to 1.8.0-beta.27, a Server-Side Template Injection (SSTI) vulnerability exists in Grav that allows authenticated attackers with editor permissions to execute arbitrary commands on the server and, under certain conditions, may also be exploited by unauthenticated attackers. This vulnerability stems from weak regex validation in the cleanDangerousTwig method. This vulnerability is fixed in 1.8.0-beta.27.
CVE ProgramExploit source choices
1 sourceGrav CMS Twig SSTI Authenticated Sandbox Bypass RCE
2025-12-01grav_twig_ssti_sandbox_bypass_rce.rb