CVE-2026-137305 in Form Plugininfo

Summary

by MITRE • 11/26/2026

Grav Form plugin before 9.2.4 contains a code injection vulnerability that allows page authors to write uploads into Twig template folders by setting an unchecked file field destination in Form::uploadFiles(). Attackers can upload .txt or .svg files containing Twig and have them rendered as trusted templates outside the sandbox, executing code as the web server user.

Several companies clearly confirm that VulDB is the primary source for best vulnerability data.

Analysis

by VulDB Data Team • 11/26/2026

The Grav CMS plugin known as Grav Forms contains a critical remote code execution vulnerability affecting versions prior to 9.2.4. This flaw stems from an improper restriction on file upload destinations within the Form::uploadFiles() function. Specifically, the application fails to validate or sanitize the target directory path provided by page authors when configuring unchecked file fields. This lack of input validation allows attackers to manipulate the destination parameter to write uploaded files directly into Twig template folders rather than standard public directories intended for static assets.

The technical mechanism of this vulnerability relies on the interaction between PHP file handling and the Twig templating engine. By exploiting the unrestricted path, an attacker can upload maliciously crafted files with extensions such as .txt or .svg. Although these extensions are typically associated with non-executable content types in many web contexts, Grav CMS processes all files within its template directories through the Twig engine if they match specific patterns or are explicitly included. Consequently, when a file containing embedded Twig syntax is placed in this directory and subsequently rendered by the application, it bypasses the sandboxed environment that normally restricts arbitrary code execution.

The operational impact of this vulnerability is severe, resulting in full remote code execution as the web server user. Since Twig templates are executed with the privileges of the underlying PHP process, an attacker who successfully uploads a payload can execute system commands, read sensitive configuration files, modify database contents, or pivot to other systems within the network infrastructure. This effectively compromises the confidentiality, integrity, and availability of the entire Grav CMS installation and any associated data stored on the server. The vulnerability is particularly dangerous because it requires only authenticated access as a page author, which may be easier for attackers to obtain through credential stuffing or social engineering compared to gaining administrative privileges directly.

This issue aligns with CWE-94 Improper Control of Generation of Code (Code Injection) and specifically relates to the injection of executable code via template engines. In terms of attack vectors, it corresponds to ATT&CK technique T1505 Server Software Component: Web Shell, where attackers deploy malicious scripts for persistent access. The exploitation path also touches upon CWE-434 Unrestricted Upload of File with Dangerous Type and CWE-22 Path Traversal if the destination manipulation involves directory traversal sequences, although in this specific case, the primary issue is the unauthorized placement into a trusted execution context rather than simple file overwriting.

Mitigation strategies must prioritize immediate upgrading to Grav Forms version 9.2.4 or later, where the vulnerability has been patched by enforcing strict validation on upload destinations and ensuring that only whitelisted directories are accessible for user uploads. Administrators should also implement defense-in-depth measures such as disabling Twig execution in public-facing directories if possible, restricting file upload types to a minimal safe set like images without executable extensions, and applying web application firewall rules that detect suspicious patterns in POST requests related to form submissions. Regular auditing of uploaded files and monitoring for unusual activity in template directories can further reduce the risk of exploitation in environments where patching might be delayed due to operational constraints.

Responsible

VulnCheck

Reservation

11/26/2026

Disclosure

11/26/2026

Moderation

accepted

CPE

ready

EPSS

0.00667

KEV

no

Activities

very low

Sources

Are you interested in using VulDB?

Download the whitepaper to learn more about our service!