Loading advisory.
Loading advisory.
Grav has Insecure Deserialization in File Cache
Severity: High CWE: CWE-502 Location: system/src/Grav/Framework/Cache/Adapter/FileCache.php Sink: unserialize($value, ['allowed_classes' => true])
Published 2026-04-28 20:30 UTC · Modified 2026-09-10 03:51 UTC
Severity and EPSS are shown separately. Helm does not combine them into one score. How tiers work
| Package | Ecosystem | Affected | Fixed in | Upgrade command |
|---|---|---|---|---|
| getgrav/grav | Packagist | < 2.0.0-beta.2 versions 0.8.0, 0.9.0, 0.9.1, 0.9.10, 0.9.11, 0.9.12, 0.9.13, 0.9.14, 0.9.15, 0.9.16, 0.9.17, 0.9.18, 0.9.19, 0.9.2, 0.9.20, 0.9.21, 0.9.22, 0.9.23, 0.9.24, 0.9.25 and 301 more | 2.0.0-beta.2 | composer require 'getgrav/grav:>=2.0.0-beta.2' |
Severity: High
CWE: CWE-502
Location: system/src/Grav/Framework/Cache/Adapter/FileCache.php
Sink: unserialize($value, ['allowed_classes' => true])
Affected: >= 1.7.44 and <= 1.7.49.5 (verified in current codebase and changelog-covered releases).
Fixed: No upstream fix identified in the reviewed branch at the time of analysis.
Notes: Earlier 1.7.x releases may also be affected, but were not fully back-traced in this review.
allowed_classes => true allows object instantiation and does not constrain classes.
Local PHP runtime.
Goal is to validate the deserialization primitive used in cache retrieval.
php -r '
class CacheWakeup { public function __wakeup(){ file_put_contents("/tmp/grav_filecache_poc.txt", "wakeup"); } }
$payload = serialize(new CacheWakeup());
unserialize($payload, ["allowed_classes" => true]);
echo file_exists("/tmp/grav_filecache_poc.txt") ? "FILECACHE_UNSERIALIZE_TRIGGERED\n" : "FILECACHE_UNSERIALIZE_NOT_TRIGGERED\n";
'Output contains: FILECACHE_UNSERIALIZE_TRIGGERED.
This reproduces the same unsafe primitive used by FileCache::doGet():
unserialize($value, ['allowed_classes' => true]).
If cache files are attacker-tampered, object magic methods may execute.
Cache file poisoning/tampering capability.
Avoid object deserialization in cache payloads.
Use non-object formats and integrity protection for cache files.
Fixed in Grav core on the 2.0 branch: commit c66dfeb5f — will ship in 2.0.0-beta.2.
What changed: Framework\Cache\Adapter\FileCache now HMAC-signs every cache payload with Security::getNonceKey() on write, and verifies the HMAC on read. Tampered, forged, or pre-upgrade files are treated as cache misses and unlinked instead of being unserialized. The on-disk format is now versioned:
v2
<expires>
<key>
<hmac-hex>
<serialized>Existing caches rebuild transparently on first read. Note that Framework\Cache\Adapter\FileCache isn't wired into Grav's main cache path — Symfony's FilesystemAdapter is — but the class is reachable by plugin and downstream consumers, so the hardening applies defensively.
Files:
tests/unit/Grav/Common/Security/FileCacheSecurityTest.php — round-trip, tampered-payload rejection, wrong-key forgery rejection, pre-v2 file rebuild, key-field mismatch.
No public exploit code known to Helm's sources (Nuclei templates, Metasploit, Exploit-DB and PoC-in-GitHub). That does not mean none exists.
EPSS went from 0.002 on 2026-11-24 to 0.004 on 2026-11-26, over 2 recorded scores.
| Date | Score | Previous | Model |
|---|---|---|---|
| 2026-11-24 | 0.002 | first score | v2026.06.15 |
| 2026-11-26 | 0.004 | 0.002 | v2026.06.15 |