GHSA-94Q7-VRQR-CX5V
Scoped API key can act on super-admin accounts across seven user-management endpoints
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-94Q7-VRQR-CX5V divulgada | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
requireNotSuperTarget() in UsersController.php guards seven of the most
sensitive endpoints in this plugin against being used as an escalation path
against super-admin accounts. It checks isSuperAdmin($current), the acting
account's own super status, rather than whether the specific API key used for
the request carries super authority. Every one of its callers already has
$request available in scope, but it is never threaded through to this shared
helper.
The established pattern this breaks
This codebase has a documented convention, visible directly in its own code
comments elsewhere: raw isSuperAdmin()/hasPermission() calls do not apply the
API-key scope cap on their own, and using them directly for an authorization
decision has already produced at least two real, fixed vulnerabilities in
this exact plugin (GHSA-p57v-xhv3-mf2w, GHSA-435x-66r2-jwv2). A scope-aware
equivalent, isSuperWithinScope($request), already exists in this codebase for
exactly this purpose.
Root cause
// classes/Api/Controllers/UsersController.php
private function requireNotSuperTarget(UserInterface $current, UserInterface $target): void
{
if ($current->username === $target->username) {
return;
}
if (!$this->isSuperAdmin($current) && $this->accessGrantsSuper($target->get('access'))) {
throw new ForbiddenException('Only super-admins can manage super-admin accounts.');
}
}
The function's own docblock states its exact purpose:
- mutators -- create()/update()/delete() -- already carry this guard; these
- siblings target /users/{username} too and must not become an escalation
- path (e.g. minting an API key for, or stripping 2FA from, a super-admin).
That is precisely the scenario this gap enables.
Confirming $request is available at every call site
grep -n "requireNotSuperTarget(" classes/Api/Controllers/UsersController.php
417: rowAction(ServerRequestInterface $request) -> requireNotSuperTarget($currentUser, $target)
1190: uploadAvatar(ServerRequestInterface $request) -> requireNotSuperTarget($currentUser, $user)
1274: deleteAvatar(ServerRequestInterface $request) -> requireNotSuperTarget($currentUser, $user)
1313: generate2fa(ServerRequestInterface $request) -> requireNotSuperTarget($currentUser, $user)
1416: disable2fa(ServerRequestInterface $request) -> requireNotSuperTarget($currentUser, $user)
1469: createApiKey(ServerRequestInterface $request) -> requireNotSuperTarget($this->getUser($request), $user)
1526: deleteApiKey(ServerRequestInterface $request) -> requireNotSuperTarget($this->getUser($request), $user)
Every enclosing controller method already receives $request as a parameter.
There is no architectural reason it could not be passed through; it simply
is not.
Impact
An API key scoped to something less than full super authority, but belonging
to an account that is itself a super-admin, can act against a different
super-admin's account through any of these 7 endpoints: disable another
super-admin's 2FA, delete their avatar, mint a new API key under their
identity, or delete one of their existing API keys. The scope cap this
codebase otherwise enforces consistently (per GHSA-p57v-xhv3-mf2w and
GHSA-435x-66r2-jwv2) is bypassed here specifically, because the check asks
"is this account a super-admin" rather than "does this specific credential
carry super authority."
Suggested fix
private function requireNotSuperTarget(ServerRequestInterface $request, UserInterface $current, UserInterface $target): void
{
if ($current->username === $target->username) {
return;
}
if (!$this->isSuperWithinScope($request) && $this->accessGrantsSuper($target->get('access'))) {
throw new ForbiddenException('Only super-admins can manage super-admin accounts.');
}
}
Update all 7 call sites to pass $request through, mirroring the fix already
applied for mayWriteUsersScope().
Affected component
- classes/Api/Controllers/UsersController.php, requireNotSuperTarget() and its
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Packagistgetgrav/grav-plugin-api |
Corregida | 1.0.18 | — | — |
1.0.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-94q7-vrqr-cx5vLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
