Summary
A critical authorization flaw in the Grav API plugin allows an API key with less than full super authority to perform sensitive actions against other super-admin accounts when it belongs to a super-admin user. This may let an attacker disable two-factor authentication, remove avatars, create API keys, or delete existing API keys under another administrator's identity when the affected endpoints are accessible.
Affected context
The issue occurs in the Grav API plugin's user-management endpoints when authorization is evaluated for API-key requests. Deployments may be exposed when a scoped API key is associated with a super-admin account and the plugin determines privilege from the account rather than the specific key's permitted scope. The affected behavior spans seven sensitive endpoints in UsersController.php.
Exploit preconditions
- Attack surface: Grav API user-management endpoints
- Required access: A valid API key associated with a super-admin account, but lacking full super authority
- Trigger point: Requests to sensitive endpoints protected by
requireNotSuperTarget() - Why exploitation is possible: The authorization check evaluates
isSuperAdmin()for the acting account instead of verifying the API key's authority withisSuperWithinScope(), allowing an insufficiently scoped key to target other super-admin accounts
Why this happens
The underlying bug is an authorization decision based on the identity's broad administrative status rather than the effective permissions of the credential used for the request. The vulnerable check treats membership in a super-admin account as sufficient authority, even when the associated API key has a narrower scope. This is a form of CWE-863: Incorrect Authorization, because the application fails to enforce the intended permission boundary for a protected operation.
Potential impact
- An attacker may disable two-factor authentication for another super-admin account.
- An attacker could delete another administrator's avatar or existing API keys.
- An attacker may mint new API keys under another administrator's identity.
- Compromised or mis-scoped credentials could enable persistence and broader administrative abuse.
- Administrative account integrity and API access controls could be weakened.
General mitigation guidance
Mitigation generally focuses on authorizing every sensitive action against the effective scope of the presented credential.
Common defensive patterns include:
- Evaluate API-key permissions directly rather than inferring authority from the owning account.
- Apply a deny-by-default policy for operations involving super-admin identities.
- Centralize scope checks so every protected endpoint uses the same authorization logic.
- Require explicit, narrowly scoped privileges for disabling MFA, managing API keys, and modifying administrator records.
- Limit API-key creation and management capabilities, and avoid granting credentials broader authority than necessary.
- Record and review sensitive authorization decisions, including the acting key scope and target account.
How teams detect issues like this
Organizations can identify similar flaws through:
- Static analysis and code review searches for authorization checks based on user roles without corresponding credential-scope checks.
- Review of controller methods that compare actor identity or account status instead of effective permissions.
- Policy tests ensuring reduced-scope API keys cannot perform operations reserved for broader scopes.
- Integration tests covering cross-account actions against administrator and super-admin targets.
- Audit-log monitoring for unexpected MFA changes, API-key creation, or API-key deletion involving privileged accounts.
- Automated security review tools that flag inconsistent authorization logic across related endpoints.

