<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Grav-Plugin-Form — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/products/grav-plugin-form/</link><description>Trending threats, MITRE ATT&amp;CK coverage, and detection metadata — refreshed continuously.</description><generator>Hugo</generator><language>en</language><managingEditor>hello@craftedsignal.io</managingEditor><webMaster>hello@craftedsignal.io</webMaster><lastBuildDate>Tue, 09 Jan 2024 12:00:00 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/products/grav-plugin-form/feed.xml" rel="self" type="application/rss+xml"/><item><title>Grav Form Plugin Anonymous Page Content Overwrite Vulnerability</title><link>https://feed.craftedsignal.io/briefs/2024-01-09-grav-form-plugin-overwrite/</link><pubDate>Tue, 09 Jan 2024 12:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-09-grav-form-plugin-overwrite/</guid><description>Grav Form plugin versions before 9.1.0 allow unauthenticated users to overwrite page content by uploading a malicious markdown file, leading to potential privilege escalation by crafting a new super-admin user.</description><content:encoded><![CDATA[<p>The Grav CMS Form plugin, specifically in versions prior to 9.1.0, contains a vulnerability allowing unauthenticated users to overwrite existing page content. This flaw resides in the file upload handling mechanism within <code>user/plugins/form/classes/Form.php</code>, where the filename of an uploaded file can be controlled via a POST request. The <code>Utils::checkFilename()</code> function insufficiently filters filenames, failing to block <code>.md</code> extensions. By exploiting this, an attacker can upload a malicious <code>.md</code> file, crafted to overwrite the content of an existing page. This enables attackers to inject arbitrary content, including YAML frontmatter, leading to privilege escalation by creating new administrator accounts. This vulnerability was tested on Form version 9.0.3, released on April 28th.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An unauthenticated attacker identifies a Grav page using the Form plugin with a file upload field that accepts all file types (<code>accept: ['*']</code>).</li>
<li>The attacker crafts a malicious <code>.md</code> file containing YAML frontmatter designed to create a new administrator account (e.g., <code>viaup.yaml</code> as described in the PoC).</li>
<li>The attacker uploads the malicious <code>.md</code> file, setting the <code>filename</code> parameter in the POST request to match the target page&rsquo;s content file name (e.g., <code>form.md</code>).</li>
<li>The <code>Form::uploadFiles()</code> function processes the upload, using the attacker-controlled filename to store the file in flash storage.</li>
<li>Upon form submission, <code>Form::copyFiles()</code> moves the uploaded file to its final destination, overwriting the original <code>.md</code> file of the target page.</li>
<li>The attacker accesses the target page via a <code>GET</code> request, causing Grav to parse the newly overwritten <code>.md</code> file and its injected YAML frontmatter.</li>
<li>The injected YAML frontmatter creates a new super-admin user.</li>
<li>The attacker uses the credentials of the newly created super-admin user to log in and gain administrative control of the Grav CMS instance.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this vulnerability allows unauthenticated attackers to overwrite existing page content, inject malicious code, and ultimately escalate their privileges to super-admin. This grants them complete control over the Grav CMS instance, potentially leading to data theft, website defacement, or further malicious activities. This vulnerability impacts any Grav page allowing file uploads with insufficiently restricted file types and can result in complete compromise of the Grav CMS.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Apply the remediation patch described in the advisory by upgrading to Grav Form plugin version 9.1.0 or later to address CVE-2026-42845.</li>
<li>Implement the provided code snippet within <code>user/plugins/form/classes/Form.php</code> to block uploads of sensitive page content file types (<code>.md</code>, <code>.yaml</code>, <code>.yml</code>, <code>.json</code>, <code>.twig</code>) to prevent page content overwrites.</li>
<li>Add <code>md, yaml, yml, json, twig, ini</code> to the <code>security.uploads_dangerous_extensions</code> list in Grav&rsquo;s configuration to prevent these file types from being processed.</li>
<li>Deploy the Sigma rule &ldquo;Detect Grav Form Plugin Page Content Overwrite Attempt&rdquo; to identify potential exploitation attempts by monitoring for uploads of markdown or YAML files to the pages directory.</li>
<li>Monitor web server logs for POST requests to form submission endpoints that contain the <code>filename</code> parameter with values matching page content filenames (e.g., <code>form.md</code>, <code>default.md</code>).</li>
</ul>
]]></content:encoded><category domain="severity">critical</category><category domain="type">advisory</category><category>grav</category><category>cms</category><category>file-upload</category><category>privilege-escalation</category><category>content-overwrite</category></item></channel></rss>