<?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 (&lt; 2.0.0-Beta.2) — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/products/grav--2.0.0-beta.2/</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, 30 Jan 2024 12:00:00 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/products/grav--2.0.0-beta.2/feed.xml" rel="self" type="application/rss+xml"/><item><title>Grav File Cache Insecure Deserialization Vulnerability</title><link>https://feed.craftedsignal.io/briefs/2024-01-30-grav-filecache-deserialization/</link><pubDate>Tue, 30 Jan 2024 12:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-30-grav-filecache-deserialization/</guid><description>Grav versions 1.7.44 through 1.7.49.5 are vulnerable to insecure deserialization in the File Cache component, where the `unserialize` function with `allowed_classes =&gt; true` can lead to arbitrary code execution if an attacker tampers with cache files.</description><content:encoded><![CDATA[<p>Grav, a flat-file CMS, versions 1.7.44 through 1.7.49.5 are susceptible to an insecure deserialization vulnerability within the <code>FileCache</code> component. Specifically, the <code>unserialize()</code> function in <code>system/src/Grav/Framework/Cache/Adapter/FileCache.php</code> utilizes the <code>allowed_classes =&gt; true</code> option, which permits the instantiation of arbitrary classes without any restrictions. This vulnerability can be exploited if an attacker gains the ability to tamper with or poison the cache files used by Grav. By injecting malicious serialized objects into these cache files, an attacker can trigger the execution of arbitrary code when the application attempts to deserialize the tampered cache data. This issue was reported on May 5th, 2026. A fix has been implemented in Grav core on the 2.0 branch (commit <code>c66dfeb5f</code>), set to be included in version 2.0.0-beta.2. This fix introduces HMAC signing and verification to ensure the integrity of cache payloads.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>The attacker gains access to the Grav server&rsquo;s filesystem with write privileges to the cache directory.</li>
<li>The attacker crafts a malicious PHP object that, when unserialized, will execute arbitrary code. This payload could leverage existing classes or magic methods like <code>__wakeup()</code> to achieve code execution.</li>
<li>The attacker serializes the malicious PHP object using the <code>serialize()</code> function.</li>
<li>The attacker overwrites an existing cache file or creates a new one containing the serialized payload in the Grav cache directory (location varies based on configuration, but default is often in <code>cache/</code>).</li>
<li>The Grav application attempts to read the tampered cache file using the <code>FileCache::doGet()</code> function.</li>
<li>The <code>unserialize($value, ['allowed_classes' =&gt; true])</code> function is called on the tampered cache data.</li>
<li>The malicious PHP object is deserialized, triggering the execution of the attacker&rsquo;s code.</li>
<li>The attacker achieves arbitrary code execution on the Grav server, potentially leading to full system compromise, data exfiltration, or further malicious activities.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this vulnerability allows attackers to execute arbitrary code on the Grav server. This can lead to complete system compromise, data exfiltration, defacement of websites, or the installation of backdoors for persistent access. Given that Grav is a CMS, this can impact any website or application built on the platform. The number of potential victims is dependent on the number of Grav installations running the vulnerable versions (1.7.44 - 1.7.49.5) and the attacker&rsquo;s ability to access and modify the cache files.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Upgrade to Grav version 2.0.0-beta.2 or later, where the vulnerability is addressed with HMAC signing of cache payloads, as detailed in commit <code>c66dfeb5f</code>.</li>
<li>Monitor file system access, particularly writes to the cache directory, for suspicious activity. Consider deploying file integrity monitoring tools to detect unauthorized modifications to cache files.</li>
<li>If upgrading is not immediately feasible, implement strict access controls to the cache directory to prevent unauthorized write access.</li>
<li>Review and audit any plugins or custom code that utilize the <code>Grav\Framework\Cache\Adapter\FileCache</code> class, ensuring they are not susceptible to cache poisoning attacks.</li>
<li>Implement the provided PoC locally to validate your exposure and test the effectiveness of mitigations.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>insecure-deserialization</category><category>code-execution</category><category>grav</category><category>web-application</category></item></channel></rss>