Grav CMS versions prior to 1.8.0-beta.27 contain a Server-Side Template Injection (SSTI) vulnerability (CVE-2025-66294) that allows authenticated users with editor permissions to execute arbitrary commands on the server. This vulnerability arises from weak regex sanitization in the cleanDangerousTwig method, which fails to block nested function calls in Twig templates. Under certain conditions, unauthenticated attackers may also exploit this if a vulnerable form exists that processes user input through evaluate_twig. The flaw enables bypassing of sanitization and execution of arbitrary payloads via crafted form messages.