GHSA-9G3M-8MR9-78VR
API plugin: scoped API key can bypass a page's permission rules
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-9G3M-8MR9-78VR divulgada · CVSS 4.3 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
A scoped API key is meant to be capped at its `scopes`, whatever its owning account may do. The checks that apply a page's own frontmatter `permissions` read the owning account's authority instead of the key's. A scoped key minted on a super-admin account ignored a page's explicit deny, and a key scoped to media borrowed the account's `api.pages.write` when deciding whether it may change a page's media.
Affected versions
grav-plugin-api 1.0.16 through 1.1.10. The super-admin override affects 1.0.16 and later. The `api.pages.write` fallback affects 1.1.10 only.
The original report covered page media. Validation found that the same super-admin override also applies to editing, deleting, moving, copying and reading pages through a scoped key, and that it goes back to 1.0.16, when page frontmatter permissions came to the API.
Details
Page rules are applied by three shared checks in `AbstractApiController`: `authorizePageAction()` (single-page reads and writes), `assertPageNotDenied()` (page media before 1.1.10, media reads, batch, reorganize, compare, copy and subtree checks) and, in 1.1.10, `pageUpdateRefusal()` (page media writes, blueprint file fields that save into a page folder, and the `permissions.media` flag on `GET /pages/{route}`).
Each check let a super-admin account skip the page's rules by reading the account's super flag directly. That bypassed the API-key scope cap, so a key whose scopes carry neither `api.super` nor `admin.super` still overrode a page that denies `update`, `delete` or `read`. In 1.1.10, `pageUpdateRefusal()` also fell back to the account's `api.pages.write` on pages whose rules don't decide `update`, so a key scoped to `api.media.write` could change media on a page that is read-only for its account, while the same key was correctly refused `PATCH` on that page.
Impact
Whoever holds a scoped API key on an account with `api.pages.write` or super-admin rights can act outside the key's scopes on pages whose `permissions` frontmatter restricts them: upload, delete or re-describe page media, write file-field files into the page folder, and, for super-admin accounts, edit, delete or read pages that deny those actions. The impact stays within what the owning account could do with an unscoped credential.
Patches
Fixed in grav-plugin-api 1.1.11. The page-rule checks now go through the scope-capped helpers: a scoped key overrides page rules only when its scopes include `admin.super`, and the `api.pages.write` fallback is checked against the key's scopes. Until you can update, avoid minting scoped keys on super-admin accounts, and treat a scoped key on an editor account as able to change media on any page that account can read.
Credits
Reported by @sandymac.
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-9g3m-8mr9-78vrLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
