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:N

Description

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 Program

Exploit source choices

1 source
Grav CMS Twig SSTI Authenticated Sandbox Bypass RCE
MSF-multi--http--grav_twig_ssti_sandbox_bypass_rceMetasploitLinux,Unix,Windows / remotePreferred

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.

2025-12-01grav_twig_ssti_sandbox_bypass_rce.rb