{"id":"CVE-2026-7317","aliases":["CVE-2026-7317","GHSA-gwfr-jfjf-92vv"],"related":[],"kind":"vulnerability","state":"published","title":"Grav CMS Cache Value FileCache.php doGet deserialization","summary":"A vulnerability was found in Grav CMS up to 1.7.49.5/2.0.0-beta.1. Affected by this vulnerability is the function FileCache::doGet of the file system/src/Grav/Framework/Cache/Adapter/FileCache.php of the component Cache Value Handler. The manipulation results in deserialization. The attack may be launched remotely. The attack requires a high level of complexity. The exploitation appears to be difficult. The exploit has been made public and could be used. Upgrading to version 2.0.0-beta.2 addresses this issue. The patch is identified as c66dfeb5f. The affected component should be upgraded.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"A vulnerability was found in Grav CMS up to 1.7.49.5/2.0.0-beta.1. Affected by this vulnerability is the function FileCache::doGet of the file system/src/Grav/Framework/Cache/Adapter/FileCache.php of the component Cache Value Handler. The manipulation results in deserialization. The attack may be launched remotely. The attack requires a high level of complexity. The exploitation appears to be difficult. The exploit has been made public and could be used. Upgrading to version 2.0.0-beta.2 addresses this issue. The patch is identified as c66dfeb5f. The affected component should be upgraded.","source":"cvelist"},{"lang":"en","text":"# Insecure Deserialization in File Cache\n\n- **Severity:** High \n- **CWE:** CWE-502\n- **Location:** `system/src/Grav/Framework/Cache/Adapter/FileCache.php`\n- **Sink:** `unserialize($value, ['allowed_classes' => true])`\n\n## Affected version(s)\n\n- **Affected:** `>= 1.7.44` and `<= 1.7.49.5` (verified in current codebase and changelog-covered releases).\n- **Fixed:** No upstream fix identified in the reviewed branch at the time of analysis.\n- **Notes:** Earlier `1.7.x` releases may also be affected, but were not fully back-traced in this review.\n\n## Notes\n`allowed_classes => true` allows object instantiation and does not constrain classes.\n\n## PoC (Primitive Demonstration)\n\n### Preconditions\n- Local PHP runtime.\n- Goal is to validate the deserialization primitive used in cache retrieval.\n\n### Steps\n```bash\nphp -r '\nclass CacheWakeup { public function __wakeup(){ file_put_contents(\"/tmp/grav_filecache_poc.txt\", \"wakeup\"); } }\n\n$payload = serialize(new CacheWakeup());\nunserialize($payload, [\"allowed_classes\" => true]);\n\necho file_exists(\"/tmp/grav_filecache_poc.txt\") ? \"FILECACHE_UNSERIALIZE_TRIGGERED\\n\" : \"FILECACHE_UNSERIALIZE_NOT_TRIGGERED\\n\";\n'\n```\n\n### Expected Result\n- Output contains: `FILECACHE_UNSERIALIZE_TRIGGERED`.\n\n### Interpretation\nThis reproduces the same unsafe primitive used by `FileCache::doGet()`:\n`unserialize($value, ['allowed_classes' => true])`.\nIf cache files are attacker-tampered, object magic methods may execute.\n\n## Exploit Preconditions\n- Cache file poisoning/tampering capability.\n\n## Recommendation\n- Avoid object deserialization in cache payloads.\n- Use non-object formats and integrity protection for cache files.\n\n\n\n---\n\n## Maintainer note — fix applied (2026-04-24)\n\nFixed in Grav core on the `2.0` branch: commit [`c66dfeb5f`](https://github.com/getgrav/grav/commit/c66dfeb5f) — will ship in **2.0.0-beta.2**.\n\n**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:\n\n```\nv2\n<expires>\n<key>\n<hmac-hex>\n<serialized>\n```\n\nExisting 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.\n\n**Files:**\n- [`system/src/Grav/Framework/Cache/Adapter/FileCache.php`](https://github.com/getgrav/grav/blob/2.0/system/src/Grav/Framework/Cache/Adapter/FileCache.php).\n- [`tests/unit/Grav/Common/Security/FileCacheSecurityTest.php`](https://github.com/getgrav/grav/blob/2.0/tests/unit/Grav/Common/Security/FileCacheSecurityTest.php) — round-trip, tampered-payload rejection, wrong-key forgery rejection, pre-v2 file rebuild, key-field mismatch.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Una vulnerabilidad fue encontrada en Grav CMS hasta 1.7.49.5/2.0.0-beta.1. Afectada por esta vulnerabilidad es la función FileCache::doGet del archivo system/src/Grav/Framework/Cache/Adapter/FileCache.php del componente Gestor de Valores de Caché. La manipulación resulta en deserialización. El ataque puede ser lanzado remotamente. El ataque requiere un alto nivel de complejidad. La explotación parece ser difícil. El exploit ha sido hecho público y podría ser usado. Actualizar a la versión 2.0.0-beta.2 aborda este problema. El parche es identificado como c66dfeb5f. El componente afectado debería ser actualizado.","source":"nvd"}],"published":"2026-04-28T20:30:16.285Z","modified":"2026-09-10T03:51:05.743Z","severity":{"scorer":"VulDB","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:H/AT:N/PR:L/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N/E:P","score":2.3,"rating":"LOW"},"severities":[{"scorer":"VulDB","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:H/AT:N/PR:L/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N/E:P","score":2.3,"rating":"LOW"},{"scorer":"VulDB","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L/E:P/RL:O/RC:C","score":5,"rating":"MEDIUM"},{"scorer":"VulDB","scheme":"CVSS:3.0","vector":"CVSS:3.0/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L/E:P/RL:O/RC:C","score":5,"rating":"MEDIUM"},{"scorer":"VulDB","scheme":"CVSS:2.0","vector":"AV:N/AC:H/Au:S/C:P/I:P/A:P/E:POC/RL:OF/RC:C","score":4.6,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L","score":5,"rating":"LOW"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:H/AT:N/PR:L/UI:N/VC:L/VI:L/VA:L/SC:N/SI:N/SA:N/E:P","rating":"LOW"}],"cwes":["CWE-20","CWE-502"],"affected":[{"ranges":[{"version":"1.7.49.0","status":"affected"},{"version":"1.7.49.1","status":"affected"},{"version":"1.7.49.2","status":"affected"},{"version":"1.7.49.3","status":"affected"},{"version":"1.7.49.4","status":"affected"},{"version":"1.7.49.5","status":"affected"},{"version":"2.0.0-beta.0","status":"affected"},{"version":"2.0.0-beta.1","status":"affected"},{"version":"2.0.0-beta.2","status":"unaffected"}],"vendor":"Grav","product":"CMS","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"2.0.0-beta.2"}],"ecosystem":"Packagist","package":"getgrav/grav","purl":"pkg:composer/getgrav/grav","source":"ghsa"}],"references":[{"url":"https://vuldb.com/vuln/359965","tags":["technical-description","vdb-entry","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://vuldb.com/vuln/359965/cti","tags":["permissions-required","signature","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://vuldb.com/submit/798732","tags":["third-party-advisory","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/devsamuelsantiago/grav-cms-filecache-object-injection","tags":["exploit","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/getgrav/grav/security/advisories/GHSA-gwfr-jfjf-92vv","tags":["related","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/getgrav/grav/commit/c66dfeb5f","tags":["patch","web"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-7317","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/getgrav/grav/commit/5a12f9be8314682c8713e569e330f11805d0a663","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/getgrav/grav","tags":["package"],"sources":["ghsa"]}],"credits":["s4nnty (VulDB User)"],"assigner":"VulDB","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-04-29T12:59:03.495Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-7317","url":"https://www.cve.org/CVERecord?id=CVE-2026-7317","licence":"CVE Terms of Use","modified":"2026-04-29T13:01:56.731Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-gwfr-jfjf-92vv","url":"https://github.com/advisories/GHSA-gwfr-jfjf-92vv","licence":"CC-BY-4.0","modified":"2026-09-10T03:51:05.743Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-7317","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-7317","licence":"Public domain","modified":"2026-07-24T08:10:00.150Z"}],"updatedAt":"2026-11-25T22:59:20.016Z","epss":{"score":0.00232,"percentile":0.15084,"date":"2026-12-01T12:00:22.000Z"}}