GHSA-RXCR-HMMJ-6J2C
Anonymous visitors can inherit signed-in sessions from shared HTTP caches
Texto original en inglés · Ver en español
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-RXCR-HMMJ-6J2C divulgada | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
Grav sends page media files (and, when lazy sessions are enabled, rendered pages) with the visitor's session cookie and a one-week shared-cacheable `Cache-Control` header. Behind a shared HTTP cache that stores responses carrying `Set-Cookie`, an anonymous visitor who requests the same URL is handed the session cookie of the signed-in user who fetched it first, and the site accepts that cookie as that user.
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 cache headers were added in Grav 1.1.0. Only sites that run a shared cache that stores `Set-Cookie` responses are exposed, for example Apache `mod_cache` with a plain `CacheEnable`. nginx `proxy_cache` and Varnish with its default configuration are documented to refuse such responses (not tested here), so a default deployment of those is unlikely to be affected.
Details
Every Grav request starts a session, and the session layer re-sends the cookie of a visitor who already has one. When a file in a page folder is served through the media fallback, `Utils::download()` replaces the restrictive headers PHP set for the session with `Cache-Control: max-age=604800` (no `private`) and `Pragma: cache`, and the response carrying `Set-Cookie` goes out cacheable by anyone. Rendered pages get the same directive from the page header code, and leak the same way when `system.session.lazy` is on.
The attacker does not need to wait for a logged-in user to populate a cache entry. The query string is part of the cache key but is ignored when a file is downloaded, so a link such as `/typography/manual.pdf?x=1` that a signed-in user is persuaded to open stores their session under a URL only the attacker knows. The click is a top-level navigation, on which browsers send a `SameSite=Lax` cookie. The reproducer put Apache `mod_cache` in front of the demo site, signed `admin` in at `/login`, opened the media URL, and then showed an anonymous request for that URL receiving the admin's cookie from the cache, after which `GET /api/v1/me` answered with `username: admin` and `super_admin: true`. With the default configuration the leak also affects cookieless visitors: the cache stores the new session cookie created for a first anonymous visitor and hands the same session to every later visitor of that URL.
The victim has to be signed in through the front-end `/login` form. A user who only signed in to Admin2 with API tokens is not exposed, so the realistic victims are front-end members, plus any administrator who also uses the front-end login.
Impact
An anonymous visitor can take over a signed-in session, with that user's privileges, for as long as the session lives (30 minutes by default). It is rated High, not Critical, because it needs a shared cache that stores cookie-bearing responses, which common cache setups refuse, and a victim who signed in through the front-end login.
Patches
Fixed in Grav 2.2.18 and 1.7.53.7. A response that carries `Set-Cookie` is now marked `private`, and any `public` or `s-maxage` directive is dropped, while other directives that are already present (such as `no-store`) and the shorter `max-age` are kept. This is enforced for media downloads, regular and Flex pages, and again where PHP sends the final headers, so explicit `cache_control` values and late header changes are covered. Responses without a cookie stay cacheable.
Workarounds
Configure the shared cache not to store `Set-Cookie` headers or not to cache responses that set cookies (for Apache `mod_cache`, `CacheIgnoreHeaders Set-Cookie`), or serve static media from a path that bypasses Grav.
Credits
Discovered by Anthropic's OSS Scanner (ANT-2026-4P0O5Z6I).
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-rxcr-hmmj-6j2cLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
