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

GHSA-985R-MPJ8-5RQW

onApiUserListRowAction "unlock" handler does not check the target account's privilege level, letting an api.users.write account clear an admin.super account's lockout

Sin parche publicado
Descargar PNG JSON
CVSS
—
medium
Fuente: —
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
ParcheSin parcheEl fabricante no ha publicado corrección
Exposición101 dDesde la divulgación, 10 ago 2026, 12:06 p. m.
Detección100 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
10 ago 26
18 nov 26
20 nov 26
10 ago 26
5 sept 26
30 sept 26
25 oct 26
20 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-985R-MPJ8-5RQW divulgada
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés

The Login plugin exposes an "Unlock" row action on the Users list (via the API plugin's `onApiUserListRowActions`/`onApiUserListRowAction` events) that clears an account's failed-login rate-limit counters. The action is gated by `authorize => 'api.users.write'`, and the API plugin correctly re-verifies that permission server-side before dispatching, per its own documented security model. But `api.users.write` is a distinct, separately-grantable permission from `admin.super`, an account can have general user-management rights without being a full super-admin. The Login plugin's handler for this action, `onApiUserListRowAction()`, unlocks whatever username it's given with no check on the target account's own privilege level. The API plugin's own code comments explicitly state that per-target permission checks are the individual plugin handler's responsibility, since the API endpoint "can't know a plugin's per-target rules", so I'm filing this against Login, where the actual gap is, not against the API plugin, which documents the boundary correctly and delegates it on purpose.

Net effect: an account with `api.users.write` but not `admin.super` can repeatedly clear the login-attempt lockout on an `admin.super` account, removing the brute-force throttle specifically from the highest-value account in the system, without itself needing any elevated privilege beyond general user management.

Affected product and version

Product: Grav Login plugin, getgrav/grav-plugin-login
Confirmed present in: 3.9.1, commit 8a61317ce10796e02a51dccf089fc4cfacdb9e43

Related but correctly-designed code in a second repository, cited for context: Grav API plugin, getgrav/grav-plugin-api (`classes/Api/Controllers/UsersController.php`), which documents and implements the delegation this report is about.

Affected code

`login.php`, `onApiUserListRowAction()`:

public function onApiUserListRowAction(Event $event): void
{
    if (($event['id'] ?? '') !== 'login-unlock') {
        return;
    }

    $username = $event['username'] ?? '';
    if (!is_string($username) || $username === '') {
        return;
    }

    $language = $this->grav['language'];
    $cleared = $this->getLoginInstance()->unlockUser($username);

    $event['result'] = [
        'status' => 'success',
        'message' => $cleared
            ? $language->translate(['PLUGIN_LOGIN.LOCKOUT_UNLOCKED', $username])
            : $language->translate(['PLUGIN_LOGIN.LOCKOUT_NOT_LOCKED', $username]),
    ];
}

`login.php`, the action's declared gate:

public function onApiUserListRowActions(Event $event): void
{
    $actions = $event['actions'] ?? [];
    $actions[] = [
        'id' => 'login-unlock',
        'plugin' => 'login',
        'label' => $this->grav['language']->translate('PLUGIN_LOGIN.LOCKOUT_UNLOCK_LABEL'),
        'icon' => 'fa-unlock',
        'action' => 'unlock',
        'priority' => 10,
        'authorize' => 'api.users.write',
    ];
    $event['actions'] = $actions;
}

`classes/Api/Controllers/UsersController.php` in the API plugin repository, `rowAction()`, the part that documents the delegation:

/**
 * Security model (declaration-time `authorize` is UX, not a boundary):
 *   1. The caller must be able to list users (api.users.read).
 *   2. We re-run the declaration event and re-check the action's own
 *      `authorize` against the current user server-side, so a client can't
 *      invoke a button it was never authorized to see.
 *   3. The plugin handler receives the target username and MUST re-check
 *      permission against that specific target — this endpoint can't know a
 *      plugin's per-target rules. The two checks are independent.
 */

Step 3 is exactly the check that `onApiUserListRowAction()` in the Login plugin does not perform. The API plugin does its job correctly, verifying `api.users.write` on the caller, resolving the target to a real account, and dispatching, it's explicit that it stops there by design. The Login plugin's handler was supposed to pick up from there for anything target-sensitive, and doesn't.

Root cause

`api.users.write` and `admin.super` are separate, independently assignable permissions (confirmed in the API plugin's own `openapi.yaml`, which repeatedly documents `api.users.write` as its own gate distinct from super-admin). The Login plugin's unlock handler treats "caller has `api.users.write`" as sufficient to act on any account, including ones with higher privilege than the caller, with no comparison between the caller's role and the target's.

Verification approach

I verified this by tracing the full call path across the three repositories involved, Login (the handler with the gap), API (the dispatcher, which I confirmed does exactly what its comments say and correctly delegates target-level checks), and cross-checked that `api.users.write` is genuinely a distinct, lower permission than `admin.super`, not a synonym for it. I do not have a live, multi-account Grav instance in this environment to demonstrate the two-account end-to-end scenario (create an `api.users.write`-only account, create an `admin.super` account, lock the super-admin out, unlock it from the lesser account, confirm no error), that would need a full running site with the API plugin's authentication configured, out of scope for the source-tracing approach I've used throughout this session. Everything else, the missing check itself, the permission separation, and the API plugin's documented delegation of responsibility, is verified directly from the real source of all three repositories, not inferred.

Impact

This does not grant login access or change a password by itself, `unlockUser()` only clears rate-limit counters. But it removes the brute-force throttle from a target account on demand, from a caller who is not required to have any privilege over that specific target. In a scenario where an `api.users.write` account is compromised, or is simply held by someone the operator did not intend to have influence over super-admin account security, that account can now assist a credential-stuffing or password-guessing attempt against `admin.super` by clearing the lockout as fast as the attacker trips it, effectively neutralizing the rate limiter for the one account where it matters most.

Suggested fix

Have `onApiUserListRowAction()` load the target user and compare privilege before unlocking, for example refusing to unlock a target that has `admin.super` (or any permission the caller itself lacks) unless the caller also has `admin.super`:

public function onApiUserListRowAction(Event $event): void
{
    if (($event['id'] ?? '') !== 'login-unlock') {
        return;
    }

    $username = $event['username'] ?? '';
    if (!is_string($username) || $username === '') {
        return;
    }

    /** @var UserInterface|null $caller */
    $caller = $event['user'] ?? null;
    $target = $this->grav['accounts']->load($username);

    if ($target && $target->exists() && $target->authorize('admin.super') && (!$caller || !$caller->authorize('admin.super'))) {
        throw new ForbiddenException('Only a super admin can clear a super admin account\'s lockout.');
    }

    $language = $this->grav['language'];
    $cleared = $this->getLoginInstance()->unlockUser($username);
    ...
}

(`ForbiddenException` per the API plugin's own code, which explicitly catches and re-throws that exception type from a handler as a real 403, so this fits the existing contract rather than requiring a new one.)

===========================================================
CWE FIELD
===========================================================
CWE-863, Incorrect Authorization (missing check that the acting privilege level is sufficient relative to the specific target of the action)

===========================================================
CVSS CALCULATOR SELECTIONS (v3.1)
===========================================================
Attack Vector: Network
Attack Complexity: Low
Privileges Required: Low
User Interaction: None
Scope: Changed
Confidentiality: None
Integrity: Low
Availability: None

Resulting vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:N/I:L/A:N
Approximate score: 6.4, severity Medium (hand-computed, please re-derive via the calculator UI)

Note for the maintainer: I set Scope to Changed because the impact (weakening protection on an `admin.super` account) exceeds the authorization scope the caller was granted (`api.users.write`, a lesser permission), crossing into a security-relevant resource the caller shouldn't influence. I'd genuinely welcome your read on whether this matches your intended permission model, if `api.users.write` is meant to be effectively unrestricted over all accounts including super-admins by design, this finding doesn't apply and I'd defer to that.

===========================================================
SEVERITY FIELD
===========================================================
Low to Moderate, pending your judgment call on intended permission semantics, see note above

Versiones

Rangos afectados

Afectada Corregida
getgrav/grav-plugin-api≤ 1.0.15
1.0.15
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-985r-mpj8-5rqw

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