GHSA-vj3m-2g9h-vm4p: Grav has multiple RCE vectors: unsafe unserialize (x3), command injection in git clone, SSTI blocklist bypass
Multiple RCE vectors were found in Grav CMS. Three are critical, two are high. 1. Unsafe unserialize() in JobQueue — direct RCE gadget (Critical) system/src/Grav/Common/Scheduler/JobQueue.php:465 calls unserialize(base64decode(...)) without restricting allowedclasses.
Published May 5, 2026
Affected packages
getgrav/grav
- Ecosystem
- Composer (PHP)
- Affected
- < 2.0.0-beta.2
- Fixed in
- 2.0.0-beta.2
- Check
composer show getgrav/grav
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Multiple RCE vectors were found in Grav CMS. Three are critical, two are high.
1. Unsafe unserialize() in JobQueue — direct RCE gadget (Critical)
system/src/Grav/Common/Scheduler/JobQueue.php:465 calls unserialize(base64_decode(...)) without restricting allowed_classes. The Job class has call_user_func_array($this->command, $this->args) in its execution path, which is a direct gadget chain — inject a serialized Job with command = 'system' and args = ['whoami'].
The same codebase actually has a Serializable trait that correctly restricts classes, so this inconsistency stands out.
2. Unsafe unserialize() in FileCache — arbitrary class instantiation (Critical)
system/src/Grav/Framework/Cache/Adapter/FileCache.php:75 does unserialize($value, ['allowed_classes' => true]). That true allows instantiation of any class. If an attacker can write to the cache directory (via any file write primitive), they get object injection → RCE.
3. Unsafe unserialize() in Session (High)
system/src/Grav/Common/Session.php:116 — same allowed_classes => true pattern on session data. Lower severity since session storage is typically more restricted.
4. Command injection in git clone (Critical)
system/src/Grav/Console/Cli/InstallCommand.php:150 — only $this->destination uses escapeshellarg(). The $data['branch'], $data['url'], and $data['path'] variables go directly into the shell command without escaping. Admin-accessible via plugin/theme installation.
5. SSTI blocklist bypass (High)
system/src/Grav/Common/Security.php:267-286 — cleanDangerousTwig() blocks twig_array_map and twig_array_filter but not twig_array_reduce. Also missing file_get_contents and fwrite from the dangerous function blocklist. An attacker who can inject Twig templates can bypass the security filter.
All five are independently exploitable. The unserialize issues are the most concerning since they don't require admin access if there's any file write primitive.
— ProScan AppSec | proscan.one
---
Maintainer note — fix applied (2026-04-24)
Fixed in Grav core on the 2.0 branch: commit `c66dfeb5f` (items #1, #2, #3, #4) and commit `38685ac25` + `c66dfeb5f` (item #5) — ships in 2.0.0-beta.2.
All five vectors addressed:
- Scheduler\JobQueue unsafe unserialize —
serialized_jobnow carries a siblingserialized_job_hmacsigned withSecurity::getNonceKey().reconstructJobrefuses to unserialize an item whose HMAC is missing/mismatched and falls through to the safe structured-fields rebuild. A tampered queue file can no longer smuggle a forgedJobfor direct RCE viaJob::exec → call_user_func_array. → `system/src/Grav/Common/Scheduler/JobQueue.php`
- FileCache unsafe unserialize — same HMAC-integrity approach; see separate GHSA-gwfr-jfjf-92vv. → `system/src/Grav/Framework/Cache/Adapter/FileCache.php`
- Session::getFlashObject unsafe unserialize — payload now wrapped in a
v2|<hmac>|<serialized>envelope; legacy/forged envelopes return null instead of triggeringunserialize. → `system/src/Grav/Common/Session.php`
- InstallCommand `git clone` shell injection —
branch,url, andpathvalues read fromuser/.dependenciesare now passed throughescapeshellarg, with a--separator before url/path to block option-injection (e.g.--upload-pack=evil). → `system/src/Grav/Console/Cli/InstallCommand.php`
- SSTI blocklist bypass —
twig_array_reduce(the specific name called out) plustwig_array_someandtwig_array_everyadded tocleanDangerousTwig'sCALLABLE_DANGEROUS_NAMESalongside the existingtwig_array_map/filter. More importantly, the new Twig content sandbox in 2.0.0-beta.2 blocks this class of attack at a different layer — see the sandbox work in `38685ac25`. → `system/src/Grav/Common/Security.php`
Tests:
- `tests/unit/Grav/Common/Security/UnserializeIntegritySecurityTest.php` — 8 cases covering JobQueue + Session HMAC integrity.
- `tests/unit/Grav/Common/Security/FileCacheSecurityTest.php`.
- `tests/unit/Grav/Common/Security/CleanDangerousTwigTest.php` — new
twig_array_*entries inproviderCallbackFunctions.
Credited to Proscan-one.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More Composer (PHP) vulnerabilities
All Composer (PHP) entriesCVE-2026-75827
Grav: Blueprint dynamic-data bare-function branch is denylist-gated and omits error_log, giving arbitrary file write
critical8.8Sep 17, 2026CVE-2026-75828
Grav: detectXss() misses an event-handler attribute after an unpaired quote in an unquoted attribute value, giving stored XSS
critical8.7Sep 17, 2026CVE-2026-42607
Grav Vulnerable to Remote Code Execution (RCE) via Malicious Plugin ZIP Upload in Direct Install Feature
critical9.1May 5, 2026CVE-2026-42613
Grav Vulnerable to Privilege Escalation via Missing Server-Side Validation of groups/access
critical9.4May 5, 2026CVE-2025-66844
Grav may be vulnerable to SSRF attack via Twig Templates
critical9.1No fixDec 15, 2025
