Skip to main content
Menu
Advisories

Target-super guards ignore group-inherited super

GHSA-VV8M-JQPM-38X4Published Updated GitHub

Description

Every "is the target a super-admin?" guard in Grav's user-management surface decides by reading the target account's own access map (accessGrantsSuper($target->get('access')) and equivalents). Grav's actual authorization resolves group-inherited access as part of an account's effective permissions (UserTrait::authorize() and UserObject::authorize() in core, PermissionResolver in the API plugin). An account that holds super only through group membership — its own access contains no super flag — is completely invisible to these guards.

A non-super user manager (api.access + api.users.write) can therefore PATCH such an account's password and take it over, while the same request against an account with a direct super flag is correctly rejected with 403. All prior fixes in this area (GHSA-p97c, GHSA-94q7, GHSA-8gg4, GHSA-22p9, GHSA-985r) read only the target's own access — none considered group inheritance, so this bypasses that entire fix line.

Threat model: a lower-privilege actor (the documented user-manager delegation tier) gains control of a super-admin account.

Affected versions

The vulnerable code lives entirely in plugins; the getgrav/grav core package is not affected.

  • grav-plugin-api <= 1.0.19
  • grav-plugin-login <= 3.9.2
  • grav-plugin-admin <= 1.10.55 / 1.11.0-beta.5

Verified end-to-end on a stock Grav 2.0.19 install with api 1.0.19, admin 1.10.55, login 3.9.2.

Details

Inheritance is live authorization semantics — both layers check group access before falling through:

  • core system/src/Grav/Common/User/Traits/UserTrait.php:102-117 — authorize() consults groups.{name}.access.{action} first;
  • core system/src/Grav/Common/Flex/Types/Users/UserObject.php:311-317 — $this->getGroups()->authorize();
  • core system/src/Grav/Common/Flex/Types/UserGroups/UserGroupObject.php:75 — a group carrying admin.super authorizes every action for its members;
  • api classes/Api/PermissionResolver.php:145-175 — merged the same way.

The guards only look at the account's own map:

  • api UsersController::update() (UsersController.php:1008) — and password sits outside the field-level whitelist (:1069-1080), so passing the guard means direct account takeover;
  • api UsersController::delete() (:1160);
  • api requireNotSuperTarget() (:1584-1595), reused by seven endpoints including createApiKey() (:1474) and disable2fa() (:1421);
  • classic admin AdminController::saveUser() (AdminController.php:336-341);
  • login plugin's user-unlock row action (login.php:1857, helper at :1885).

The API plugin's own UsersController already contains a group-aware, login-state-independent resolver — effectiveAccessMap() (:1864) and userHasEffectiveAccess() (:1830) — but it is wired only to the users-list filter, never to the security guards.

A related guard in the same plugin, authorizeApiKeyTarget() (api.php:360-363), calls $target->authorize('admin.super') on an account loaded from storage. Such an account is not authenticated (the property is never persisted), so authorize() returns false for every action and this guard never fires for any super target, group-based or not. It is fixed in the same change, and it is the reason the fix reads access maps directly rather than routing the other guards through authorize(), which would make them fail open.

Preconditions are configuration-realistic: the bundled group.yaml blueprint natively offers the full super permission matrix, so "a super-granting group whose members' own access is empty" is a designed-in arrangement. Group assignment is super-only on every write path, so the attacker cannot manufacture the victim — the victim is precisely the kind of account the guards exist to protect.

PoC

Setup: user/config/groups.yaml defines a group admins granting admin.super / api.super; account boss has own access of only site.login and groups: [admins]. Logging in as boss reaches the admin dashboard — effective super via inheritance.

Actor: usermgr with api.access + api.users.write (not super by any measure).

# control — directly-flagged super account: the guard fires
PATCH /api/v1/users/admin
{"password": "Should-fail-123!"}
-> 403 "Only super-admins can modify super-admin accounts."

# attack — group-inherited super account: the guard is blind
PATCH /api/v1/users/boss
{"password": "Owned-passw0rd!"}
-> 200 (account object returned; password hash rewritten)

Then log in as boss with Owned-passw0rd! → full super-admin session.

Impact

  • User-manager roles can take over group-super accounts: full site configuration, plugin install (RCE), all data.
  • Same root cause, other variants: delete group-super accounts, mint persistent API keys in their name, or strip their 2FA — each useful in multi-step intrusions even where a password change would be noticed.
  • Any site using groups to grant admin/super — a standard Grav pattern, and the only practical model for directory-backed logins such as login-ldap — exposes all such accounts to every user manager.

Patches

Fixed in grav-plugin-api, grav-plugin-login, and grav-plugin-admin. The target guards now resolve super across the account's own access map and every group it belongs to.

Credits

Reported by @1K0CT.

Affected versions

References

GitHub · getgrav/grav