getgrav/grav
Affected
- introduced
0, fixed2.0.0-beta.2(ecosystem)
Fixed versions
2.0.0-beta.2
Fix
The export has no generic command for this ecosystem.
Advisory
Also known as: CVE-2026-7317
Grav has Insecure Deserialization in File Cache
Insecure Deserialization in File Cache
system/src/Grav/Framework/Cache/Adapter/FileCache.phpunserialize($value, ['allowed_classes' => true])Affected version(s)
>= 1.7.44 and <= 1.7.49.5 (verified in current codebase and changelog-covered releases).1.7.x releases may also be affected, but were not fully back-traced in this review.Notesallowed_classes => true allows object instantiation and does not constrain classes.
PoC (Primitive Demonstration)
Preconditions
Steps
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";
'
Expected Result
FILECACHE_UNSERIALIZE_TRIGGERED.Interpretation
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.
Exploit Preconditions
Recommendation
---
Maintainer note — fix applied (2026-04-24)
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:
Low Basis: The source's own band: LOW
0, fixed 2.0.0-beta.2 (ecosystem)2.0.0-beta.2
The export has no generic command for this ecosystem.
Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.
Check your own computer: guard packages check
Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0