GHSA-6C4V-4WRV-3559
User managers and Flex editors can overwrite, create or delete accounts through client-supplied storage keys
Texto original en inglés · Ver en español
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-6C4V-4WRV-3559 divulgada | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
Grav's Flex layer trusts storage identity that arrives with a form submission: the username of a create form, a field in a restored form flash, or a storage key sent to the Flex API. Three variants let accounts below super admin overwrite, create or delete user accounts, including the super admin's. A user manager (for example with only `admin.users.create`) can replace any existing account file through a front-end Flex create form, or create a super-admin account by replaying a form flash across Flex types. An account that is only allowed to create entries in a site-built Flex directory can delete files outside that directory, including every account file, after which the API plugin's first-run setup creates a new super admin for an unauthenticated caller.
Affected versions
Grav 2.x from 2.0.0 up to and including 2.2.17. The create form overwrite dates from Grav 1.7.0-rc.9, the flash replay from 1.7.0-beta.8 and the `__META` rename from 1.7.0-rc.6 (the file-deleting rename from 1.7.6), so the code exists on 1.7. All three are admin-tier, so no 1.7 release is part of this advisory.
Details
Create form overwrite (ANT-2026-F8WSR5D2). This is an incomplete fix of GHSA-rr73-568v-28f8. `UserObject::save()` guards against overwriting an existing account by checking `$storage->hasKey($this->getKey())`, but a form-created object has an empty key, so the check never fires. The folder storage then takes the file name from the submitted `username` field and writes it over the existing account. A manager holding only `admin.users.create` rewrites `admin.yaml`, and the real admin's password is then refused with 401. The front-end Flex create form that is needed can be added to a page by any publisher. User groups use the same path with no guard at all, and `FileStorage::renameRow()` has no "already taken" check.
Flash replay (ANT-2026-WHJNW9W9). `FlexFormFlash::init()` recreates the object from the stored flash in the directory of the form that reads it, and never compares the flashed object type. A `user-groups` flash replayed into a `user-accounts` form creates a `mallory` account with `super_admin: true`, because the replay also adopts `__META` and so treats the rebuilt object as an existing one. A group named like an account (for example `admin`) can overwrite that account file the same way.
Storage key rename (ANT-2026-PHHDKDBI). `FlexObject::__construct()` adopts `__META` from caller data before validation, and `FolderStorage::saveRow()` validates the new key but uses the old storage key from `__META` raw in `renameRow()`. `FileStorage::renameRow()` then deletes the old key's file. The Flex Objects API's `create()` only unsets the lowercase `__meta`. An account with only a `create` grant on a site-built Flex directory therefore deletes arbitrary YAML files outside the directory, which in the reproducer removed every account file, and anonymous setup then returned a super-admin token. The super-admin chain also needs the usernames. The original report rated this Medium. It is rated High because the impact (deleting account and configuration files) leaves the actor's tier.
Impact
User managers can overwrite, create or delete accounts including the super admin's, and a create-only grant on a Flex directory can destroy account and configuration files. Each variant ends in a super-admin account for the attacker or in loss of the existing accounts, which is a takeover when first-run setup reopens.
Patches
Fixed in Grav 2.2.18. `UserObject` checks the key the storage will actually write outside the new-user branch and no longer accepts a submitted `storage_key`, user groups get the same guard, and `FileStorage::renameRow()` refuses a taken key. A flash is restored only into a directory of the same Flex type and a new-object form never adopts an existing stored object. `createObject()` strips `__META`, and an internal path is used for objects loaded from storage, with old keys validated in `FolderStorage` and `PageStorage`. Renaming onto an existing name now throws, and third-party code that passes storage rows to `createObject()` needs to use the internal path. Update the Flex Objects plugin to 1.4.18 as well: `POST /flex-objects/{type}` drops the storage metadata (`__META` in either letter case), the storage key and the storage timestamp from the submitted data, and builds the object with validation switched on.
Credits
Discovered by Anthropic's OSS Scanner (ANT-2026-F8WSR5D2, ANT-2026-WHJNW9W9, ANT-2026-PHHDKDBI).
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Packagistgetgrav/grav |
Corregida | 2.2.18 | — | — |
2.2.18Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/getgrav/grav/security/advisories/GHSA-6c4v-4wrv-3559Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
