Summary
The Grav API plugin fails to enforce the declared scope of API keys minted by super-admin accounts on several privileged write endpoints. A leaked or delegated read-only key may therefore perform super-admin operations, including changing group ACLs and granting arbitrary accounts elevated privileges.
Affected context
The vulnerability affects Grav installations using API plugin versions from 1.0.6 through 1.0.11. It occurs on specific write endpoints protected by super-admin checks, including group, account configuration, preference, and dashboard widget controllers, when a scoped API key was issued by a super-admin account.
Exploit preconditions
- Attack surface: Grav API write endpoints - Required access: A valid API key, including a delegated or leaked key with
a restrictive declared scope
- Trigger point: Requests to affected super-admin-gated write operations - Why exploitation is possible: The super-admin authorization path returns
early without invoking the permission check that enforces the key's scope
cap
Why this happens
The authorization logic gives account-level super-admin status precedence over API-key scope enforcement. On affected endpoints, an isSuperAdmin() early return bypasses requirePermission(), which is the mechanism responsible for applying the key's declared restrictions. This is an instance of CWE-269, Improper Privilege Management, because authorization checks do not consistently preserve the intended privilege boundary across authentication contexts.
Potential impact
- A read-only or otherwise restricted API key may perform privileged writes
- An attacker could modify group ACL mappings
- Arbitrary accounts could be granted super-admin privileges
- Site configuration, preferences, or dashboard data could be altered
- The Grav administration surface and associated content may be compromised
General mitigation guidance
Mitigation generally focuses on enforcing authorization consistently across every authentication path and endpoint. Privilege checks should evaluate API-key scopes before honoring account-level roles, and privileged operations should use a centralized, deny-by-default authorization policy. API keys should receive only the minimum required permissions, sensitive keys should be rotated when exposure is suspected, and key storage and delegation should reduce input and credential trust. Administrative write capabilities should also run under least-privilege service accounts, with audit logging and explicit separation between read and write permissions.
How teams detect issues like this
Detection can include static and architectural analysis for authorization branches that return early on role checks, especially when scope or permission validation occurs later in the function. Code review should look for endpoint-specific super-admin exceptions, duplicated authorization logic, and API-key scope checks that are not applied uniformly. Dynamic testing can compare identical requests made with differently scoped keys and verify that restricted keys cannot reach privileged writes. Policy-as-code, CI authorization tests, and automated security review tools can help enforce consistent scope validation.

