Summary
A privilege escalation flaw in the Grav API Plugin allows authenticated callers of api.users.write to create invitations that assign new users to highly privileged groups without proper validation.
When these invitations are accepted, the resulting accounts can gain super-admin API permissions even if the inviter never had such rights, undermining the intended access control model.
Affected context
This issue arises in deployments using the Grav API Plugin with versions prior to 1.0.10, specifically where invitations are used to onboard new accounts via the API.
The vulnerability exists in the invitation creation flow, where the groups field submitted by an authenticated caller is not adequately validated against the caller's own permissions or a trusted policy.
Environments that expose api.users.write to operational tooling, internal services, or lower-privileged administrators are particularly affected, because those actors can indirectly bootstrap accounts with super-admin API capabilities.
Exploit preconditions
- Attack surface: Grav API endpoint handling user invitations (InvitationsController::create()).
- Required access: Valid, authenticated API client with
api.users.writecapability; no super-admin privileges are required. - Trigger point: Submission of a crafted invitation payload that includes a
groupsfield referencing roles or groups mapped toapi.superor equivalent super-admin permissions. - Why exploitation is possible: The server trusts the
groupsfield in the invitation request without constraining it to the inviter's permissible roles or enforcing a central policy, allowing privilege assignments beyond the caller's own authority.
Why this happens
The root cause maps to CWE-269: Improper Privilege Management.
The invitation creation logic in InvitationsController::create() treats the groups attribute from the client as authoritative and does not enforce that:
- Group assignments are limited to roles the inviter is allowed to grant, or
- Group membership changes are validated against a least-privilege policy.
This missing validation breaks the intended privilege boundary, enabling privilege escalation through legitimate-looking workflows instead of direct bypasses of authentication.
Potential impact
- New user accounts can gain
api.superor super-admin API access when invitations are accepted. - Lower-privileged operators or services can indirectly create fully privileged administrative identities.
- Attackers may perform unrestricted API operations, including configuration changes, user management, and data access.
- Compromise of audit integrity, as privileged actions appear to originate from newly created legitimate accounts rather than the original lower-privileged caller.
General mitigation guidance
Effective mitigation focuses on tightening privilege management around user provisioning flows and group assignments:
- Enforce role-granting rules that restrict which groups a caller is allowed to assign, typically limiting them to a subset equal to or lower than their own effective privileges.
- Validate and normalize group identifiers server-side, ignoring or rejecting any group names not allowed by policy, rather than trusting client-provided values.
- Implement a least-privilege onboarding process, where new accounts default to minimal roles and require separate, audited steps for elevation.
- Centralize authorization checks so that any operation altering group membership consistently consults the same policy layer, reducing the chance of bypass paths in invitation workflows.
- Consider additional approval or review workflows for assignments to highly privileged groups, especially those mapped to
api.superor equivalent capabilities.
How teams detect issues like this
Detection can leverage both code-centric and operational approaches:
- Use static analysis or code review checklists to flag patterns where client-supplied group or role identifiers are applied directly to user accounts without policy checks.
- Search for authorization gaps in provisioning paths (e.g., invitation creation, self-signup, bulk import) where group assignments are not tied back to the caller's own privileges.
- Implement audit logging that records: who created invitations, which groups were requested, and resulting group memberships when invitations are accepted; then alert on invitations placing accounts into highly privileged groups.
- Employ automated policy enforcement tools or middleware that intercepts user/group changes and validates them against a central authorization policy, regardless of which controller or endpoint initiates the change.

