GHSA-MCX6-4RVG-7R8V
Scoped API key can edit page permissions outside the scope it was granted
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-MCX6-4RVG-7R8V divulgada | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
injectSecurityTab() decides whether a page blueprint's security/permissions
section is shown as editable using the raw isSuperAdmin()/hasPermission()
calls directly, with no way to apply the API-key scope cap this codebase
otherwise consistently enforces. The function has no $request parameter at
all, the same architectural gap already fixed once in BlueprintPathResolver
(GHSA-435x-66r2-jwv2) and once more generally (GHSA-p57v-xhv3-mf2w).
The established pattern this breaks
This plugin has a documented convention, visible directly in its own code
comments: 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 two real, fixed vulnerabilities in this exact plugin.
// classes/Api/Controllers/AbstractApiController.php
/**
* Whether the caller holds $permission AND the API-key scope cap permits it.
* ... skips the cap entirely (GHSA-435x-66r2-jwv2).
*/
protected function hasPermissionWithinScope(ServerRequestInterface $request, string $permission): bool
{
return $this->hasPermission($this->getUser($request), $permission)
&& $this->scopeAllows($request, $permission);
}
Root cause
// classes/Api/Controllers/BlueprintController.php
private function injectSecurityTab(Blueprint $blueprint, ?UserInterface $user = null): void
{
...
$canManagePermissions = $user !== null
&& ($this->isSuperAdmin($user) || $this->hasPermission($user, 'api.config'));
if (isset($securityFields['_admin'])) {
if ($canManagePermissions) {
$this->clearValidateIgnore($securityFields['_admin']);
} else {
unset($securityFields['_admin']);
}
}
...
}
No ServerRequestInterface parameter exists in this function's signature, so it
cannot apply scopeAllows() the way disable2fa() and hasPermissionWithinScope()
correctly do elsewhere in this same codebase. It is called from the page
blueprint-building code (around line 715, getPageBlueprint() or similarly
named) that returns a blueprint for a page's edit form.
What I confirmed versus what needs maintainer follow-up
Confirmed: the raw, cap-less check is used here, and the function structurally
cannot apply the established scope-cap fix pattern, matching the exact
architectural shape that caused GHSA-435x-66r2-jwv2 in BlueprintPathResolver.
Not independently confirmed: whether the _admin/security-fields blueprint
section being present or absent directly gates write-time enforcement (a save
handler trusting "field present in the returned blueprint = permitted to
write"), or whether it only affects what the admin UI displays. I traced the
call chain as far as I reasonably could but did not reach a definitive save
handler consuming this specific blueprint's field presence as an authorization
signal. Blueprint-driven write validation is a real, confirmed mechanism
elsewhere in the Grav codebase family (BlueprintSchema::validate() in core), so
I think this is a reasonable concern to raise rather than dismiss, but I want
to be upfront that I am flagging a structural gap matching a known bug class
here, not a fully traced end-to-end exploit.
Minimum confirmed impact regardless of the above: a scope-capped API key
(one whose owning account has broader permissions than the key itself should
exercise) receives a blueprint response that reflects the account's full
permissions rather than the key's capped scope, an information-disclosure
issue at minimum, since it reveals what the account could do rather than what
this specific credential is allowed to do.
Suggested fix
Thread $request (or the already-resolved scope-cap boolean) into
injectSecurityTab(), matching the pattern already established for
hasPermissionWithinScope()/mayWriteUsersScope(), and verify whether any save
handler trusts this blueprint's field presence for write authorization, since
that detail determines whether this is Low (info disclosure) or High
(auth bypass) severity.
Affected component
- classes/Api/Controllers/BlueprintController.php, injectSecurityTab()
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
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-mcx6-4rvg-7r8vLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
