GHSA-GJX7-95HG-X969
Anonymous visitor can create a super-admin account on installs whose path contains brackets
Texto original en inglés · Ver en español
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-GJX7-95HG-X969 divulgada | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
On a Grav install whose path contains a folder name with a bracket pair, such as `/var/www/grav[staging]`, an anonymous visitor can create a super-admin account with a single request to the API plugin's first-run setup endpoint, or overwrite the existing `admin` account. The cause is that core's account counter always returns zero on such a path, so the setup endpoint believes no accounts exist. Apart from the folder name, which the operator chooses and the attacker cannot influence, everything involved is the default configuration.
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 pattern dates from 2019 (first released in 1.6.9). Only installs with a `[...]` pair, or a backslash, somewhere in the absolute path of the install are exposed. Stock paths such as `/var/www/html`, `public_html` and `httpdocs` are not.
Details
`UserCollection::count()` counts accounts with a `glob()` over the absolute accounts folder, and that path is not escaped. PHP reads `[staging]` as a character class, so the pattern never matches the real folder and the count is zero however many account files exist. Logins and account lookups do not use patterns and keep working, so the operator sees nothing unusual.
The API plugin's `POST /api/v1/auth/setup` is allowed without credentials while no accounts exist, and it decides that through this counter. It then loads the requested username, which returns the existing account if there is one. With the same request, an install under `/var/www/grav-staging` answers 409, while `/var/www/grav[staging]` answers 200 and returns access and refresh tokens for a new `intruder` account with `super_admin: true`. The setup endpoint never closes on an affected install, and `GET /api/v1/auth/setup` tells anyone that setup is required. Only the bracket case was reproduced against a served site. A backslash in a folder name also gives zero at the `glob()` level.
On Grav 1.7 with the classic admin plugin, the same counter gates the anonymous first-admin registration form, so those sites are exposed through that form instead of the API.
Impact
The visitor is anonymous and the result is a super-admin account, or the existing administrator's account under a password the visitor chose. Because the operator picks the folder name and the attacker cannot bring the condition about, and because very few installs meet it, this is rated High rather than Critical.
Patches
Fixed in Grav 2.2.18 and 1.7.53.7. The account counter now lists the accounts folder with `scandir()` and the same file filter the account lookup uses, instead of a `glob()` pattern, so a path with brackets or a backslash no longer reads as zero accounts. On Grav 2 sites, update the API plugin to 1.1.6 as well: first-run setup now answers 409 for a username that already exists, so even a wrong account count can no longer replace an account.
Workarounds
Move the install to a path without `[`, `]` or backslash characters, or block `POST /api/v1/auth/setup` at the web server once the first account exists.
Credits
Discovered by Anthropic's OSS Scanner (ANT-2026-W7PWSBH5).
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-gjx7-95hg-x969Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
