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

GHSA-P57V-XHV3-MF2W

userPassesAuthorize() has two independent unscoped paths, leaking authorize-gated items to scoped API keys

Parche disponible
Descargar PNG JSON
CVSS
—
low
Fuente: —
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versión1.0.14
Exposición109 dDesde la divulgación, 3 ago 2026, 9:27 a. m.
Detección107 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
3 ago 26
18 nov 26
20 nov 26
3 ago 26
30 ago 26
27 sept 26
24 oct 26
20 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-P57V-XHV3-MF2W 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

Vulnerability Details

Component: getgrav/grav-plugin-api (bundled with Grav 2.0's admin-next/API stack)
Files: `classes/Api/Controllers/AbstractApiController.php` (`userPassesAuthorize()`), plus 6 call sites: `SidebarController.php`, `FloatingWidgetController.php`, `EditorButtonsController.php`, `MenubarController.php` (each `items()`), and `UsersController.php` (`assembleColumns()`, `assembleRowActions()`, `assembleFilterTabs()`)
CWE: CWE-862 — Missing Authorization
Severity: Low
CVSS: 3.7 — CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N

### Root Cause
`userPassesAuthorize(UserInterface $user, mixed $authorize, bool $isSuperAdmin)` decides whether a caller may see/use an item gated by an `authorize` requirement (a permission string/array attached to sidebar/menubar/widget items and users-list columns/row-actions/filter-tabs). It had two independent, unscoped paths to a false "yes":

  1. The `$isSuperAdmin` boolean passed in by every call site was computed as `$this->isSuperAdmin($user)` — reading the account's raw `access.api.super` flag directly, with no reference to the calling request's `api_key_scopes`.
  2. For string/array `authorize` values, `userPassesAuthorize()` calls `$this->hasPermission($user, $authorize)` — which checks the account's real ACL grant, again with no scope-cap consultation. So even after fixing path 1, a key scoped to e.g. `["api.access", "api.pages.read"]` still passes if the underlying account's ACL happens to include the exact permission named in `authorize` (in our testing, `admin.super`, which the test account genuinely held).

A scoped API key minted on a super-admin account is meant to be capped to exactly its declared scopes — that's the entire purpose of `AbstractApiController::isSuperWithinScope()`/`scopeAllows()`, already used correctly elsewhere in this codebase. `userPassesAuthorize()` predates or bypasses that convention.

Vulnerable Code
protected function userPassesAuthorize(UserInterface $user, mixed $authorize, bool $isSuperAdmin): bool
{
    if ($authorize === null) {
        return true;
    }
    if ($isSuperAdmin) {          // <-- bare boolean, computed via isSuperAdmin($user) at each call site
        return true;
    }
    if (is_string($authorize)) {
        return $this->hasPermission($user, $authorize);   // <-- no scope-cap check
    }
    if (is_array($authorize)) {
        foreach ($authorize as $perm) {
            if (is_string($perm) && $this->hasPermission($user, $perm)) {   // <-- no scope-cap check
                return true;
            }
        }
        return false;
    }
    return false;
}

### Attack Scenario
1. Super-admin mints a scoped key intended for a narrow integration: `["api.access", "api.pages.read"]` only.
2. That key calls `GET /sidebar/items` (or floating-widget/editor-buttons/menubar items, or the users-list columns/row-actions/filter-tabs endpoints).
3. Any item gated with `authorize => 'admin.super'` (or any other permission the account's ACL happens to hold) is returned anyway, because `userPassesAuthorize()` never consulted the key's actual scope.

### Impact
- Type: CWE-862 Missing Authorization / information disclosure
- Auth required: Yes — a valid API key scoped away from the relevant permission, minted on an account that holds it
- Consequence: Disclosure of `authorize`-gated UI/metadata (item labels, plugin/action identifiers, users-list column/action/tab definitions) to a credential deliberately restricted from seeing it. All affected call sites are read-only listings — no direct code execution or data mutation from this bug alone.

Recommended Fix
// AbstractApiController — signature change: takes $request instead of a precomputed bool
protected function userPassesAuthorize(UserInterface $user, mixed $authorize, ServerRequestInterface $request): bool
{
    if ($authorize === null) {
        return true;
    }
    if ($this->isSuperWithinScope($request)) {
        return true;
    }
    if (is_string($authorize)) {
        return $this->hasPermission($user, $authorize) && $this->scopeAllows($request, $authorize);
    }
    if (is_array($authorize)) {
        foreach ($authorize as $perm) {
            if (is_string($perm) && $this->hasPermission($user, $perm) && $this->scopeAllows($request, $perm)) {
                return true;
            }
        }
        return false;
    }
    return false;
}

Every call site drops its precomputed `$isSuperAdmin = $this->isSuperAdmin($user)` line and passes `$request` directly.

### Verification
Dynamically confirmed on grav 2.0.13 / api plugin 1.0.13 in a local Docker lab, in two rounds:

Round 1 (incomplete fix caught before disclosure): applying only the `isSuperAdmin` → `isSuperWithinScope($request)` swap still leaked the gated item — a debug log confirmed the live request correctly computed `isSuper=false` for the scoped key, proving the leak came from the second, independent `hasPermission()` path.

Round 2 (complete fix): after making `userPassesAuthorize()` itself scope-aware and updating all 6 call sites, the same request with a key scoped to `["api.access", "api.pages.read"]` (minted on a super-admin account) correctly returns `{"data":[]}` (HTTP 200), while an unscoped session for the same account still sees the gated item (regression-checked).

A ready-to-apply fix branch is prepared locally against grav-plugin-api's `1.0.13` tag; happy to push it to a private fork once one is available for this advisory.

Versiones

Rangos afectados

Afectada Corregida
getgrav/grav-plugin-api< 1.0.14
1.0.14
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
Packagistgetgrav/grav-plugin-api
Corregida 1.0.14 — —
Versiones corregidas1.0.14
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-p57v-xhv3-mf2w

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