GHSA-C7QJ-Q265-Q6Q7
Publishers can delete any server file through the image format option and take over the site
Texto original en inglés · Ver en español
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-C7QJ-Q265-Q6Q7 divulgada | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
The `format` option of Grav's image actions accepts any string and uses it as part of a cache file name, which allows path traversal. A page editor (publisher) with one Markdown image can make Grav delete any file the PHP user can delete. Deleting the files in `user/accounts` puts the site into first-run setup, where an unauthenticated caller can create a super admin through the API plugin. On sites that enable `system.images.url_actions`, which is off by default, an anonymous visitor reaches the same action directly and can read and delete files.
Affected versions
Grav 2.x from 2.0.0 up to and including 2.2.17, and Grav 1.7 up to and including 1.7.53.6 (the option was added in Grav 1.7.4). On 1.7 the exposure that matters is `url_actions` sites (anonymous file read and delete), which are the reason a 1.7 release is part of this advisory.
Details
`ImageMediaTrait::format()` stores whatever string it receives. When the image is saved, the value is passed to `ImageFile::cacheFile()`, where the cache name `{hash}-{prettyName}.{type}` becomes something like `...-pic./../../../user/accounts/admin.yaml`. The cache unlinks that path when it is older than the source, or returns it as the derivative. The only type check runs afterwards. `format` is on the media action allowlist, so Markdown image URLs reach it, and sandboxed Twig does too. It is also in the list of actions that can be driven from the URL, so with `system.images.url_actions: true` an anonymous request reaches it through the media fallback and gets file read or delete.
The reproducer deletes all three account files through anonymous views of the editor's page, then calls `POST /api/v1/auth/setup`, which returns 200 and a new super admin, and that admin reads the configuration. The anonymous `url_actions` route was observed by the scanner and confirmed by reading the code but is not scripted. The other part of the cache name, `setImagePrettyName`, is urlized by the image library and is not affected.
Impact
A publisher deletes any file the PHP user can delete and takes over the site through first-run setup. The default needs a publisher account, which is why the rating is High. Where `url_actions` is enabled the exposure is anonymous and worse.
Patches
Fixed in Grav 2.2.18 and 1.7.53.7. `format()` ignores anything that is not `guess` or a key of the image library's known types (case-insensitively), and `cacheFile()` throws on an unknown type before the cache lookup.
Workarounds
Keep `system.images.url_actions` set to `false` (the default). That closes the anonymous route only; the publisher route has no configuration workaround.
Credits
Discovered by Anthropic's OSS Scanner (ANT-2026-44IYIGNC).
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Packagistgetgrav/grav |
Corregida | 1.7.53.7, 2.2.18 | — | — |
1.7.53.72.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-c7qj-q265-q6q7Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
