Summary
A privilege management flaw in authentik's user update API allows callers with change_user on a target account to assign arbitrary groups via PATCH /api/v3/core/users/{pk}/, including groups flagged as is_superuser=True.
Because this path does not enforce the stricter enable_group_superuser permission used in group-management flows, delegated user managers can escalate their own or other users' privileges to administrator-equivalent levels.
Affected context
The vulnerability occurs in authentik deployments where:
- The REST API endpoint
PATCH /api/v3/core/users/{pk}/is used to manage users. - Permissions are delegated so that some users or service accounts hold
change_user(or comparable update rights) on other user accounts. - Group membership, including groups with
is_superuser=True, is controlled both via group-management workflows and user-management workflows.
In this context, the user update serializer (UserSerializer) allows modification of group assignments without enforcing the same superuser-related permission checks that exist on group-management endpoints, creating an inconsistent authorization model.
Exploit preconditions
- Attack surface: authentik's HTTP API, specifically
PATCH /api/v3/core/users/{pk}/. - Required access:
- Valid authenticated account in the authentik instance, and
- Permission to modify a given user (e.g.,
change_useron the target user model), or equivalent delegated user-management capability. - Reachable objects: Groups that may have
is_superuser=Trueand are intended to be guarded by stricter permissions (e.g.,enable_group_superuser). - Trigger point: Sending a crafted PATCH request that updates the target user's group memberships via the user update endpoint.
- Why exploitation is possible: The user update path (
UserSerializerinPATCH /api/v3/core/users/{pk}/) performs group assignment without re-applying the stricter, superuser-specific permission checks that are enforced in the dedicated group-management APIs, allowing a caller with user-update permissions to bind users to privileged groups.
Why this happens
The core issue is an inconsistent authorization model for privilege-bearing relationships, mapping to CWE-269: Improper Privilege Management.
authentik's group-management pathways enforce a more restrictive permission (enable_group_superuser or equivalent) when assigning users to groups that grant superuser capabilities. However, the UserSerializer used by the PATCH /api/v3/core/users/{pk}/ endpoint exposes group assignment fields without reusing or replicating these stricter checks. As a result, any caller with the ability to update a user can indirectly modify that user's group memberships, including adding them to superuser groups.
Conceptually, this is a classic broken authorization boundary: privilege-sensitive operations (superuser group assignment) are protected on one code path (group APIs) but left under-protected on another (user APIs). The system treats group membership as part of user attributes without consistently validating whether the caller holds the higher-tier privilege required for superuser-related changes.
Potential impact
- Attackers with delegated user-management rights can add themselves to groups with
is_superuser=True, gaining administrator-equivalent control. - Privilege escalation on accounts they are allowed to manage, potentially turning limited operators into full administrators.
- Indirect compromise of authentication, authorization, and identity data managed by authentik (e.g., modifying OAuth/OIDC clients, policies, and directory sync).
- Expansion of blast radius for compromised low-privilege accounts that possess user-update rights, turning a minor breach into full control of the identity provider.
- Undermining of separation-of-duties policies that rely on strict control over who can create or manage superuser-level groups.
General mitigation guidance
Mitigation should focus on consistent, centralized enforcement of authorization rules for privilege-bearing relationships such as group membership, especially when those groups confer superuser or administrative capabilities.
Useful defensive patterns include:
- Centralize privilege checks: Implement a single, reusable authorization layer for group membership changes that applies across all code paths (user-centric and group-centric APIs). Any route that can alter group membership should call into the same permission checks.
- Treat superuser flags as high-risk attributes: Handle
is_superuserand similar flags as separate privileged operations, even when exposed through aggregate data structures like user objects. Require dedicated, clearly named permissions for any transition that adds or removes such capabilities. - Narrow delegated permissions: When designing roles for delegated user management, separate "manage basic user attributes" from "manage group membership," and further separate "manage high-privilege groups." Avoid granting group or permission management to routine helpdesk or operational roles.
- Use defense-in-depth on serializers and DTOs: When serializers or DTOs expose nested relationships like groups or roles, implement per-field or per-relation access control checks rather than relying solely on model-level permissions.
- Implement policy-based access control: Introduce policies that can express constraints like "this role may only assign non-privileged groups," and enforce those policies at the API layer.
- Adopt least-privilege defaults: Ensure that by default, user-management APIs cannot modify privileged groups unless an explicit, high-sensitivity permission is attached. Make privilege-raising operations explicit and auditable.
- Audit and governance controls: Regularly review which roles or service accounts can update users and which can assign privileged groups. Integrate these reviews into your standard identity governance processes.
How teams detect issues like this
Detection can focus on both code-level indicators and runtime behavior:
Static/code-level strategies
- Search for endpoints or serializers that:
- Allow modification of group, role, or permission fields attached to user objects.
- Do not invoke the same authorization logic as the dedicated group/role management APIs.
- Add static analysis or linting rules that flag:
- Direct writes to group membership or privilege flags without passing through a centralized access control function.
- Multiple, inconsistent authorization checks for the same sensitive relationship (e.g., superuser groups).
- During code review, pay special attention to:
- Any new API that can update users, groups, or permissions.
- Serializer fields that expose nested privilege-related objects.
- "Shortcut" endpoints introduced for convenience, which might bypass policy engines.
Runtime/log-based strategies
- Monitor audit logs for:
- User accounts acquiring superuser or administrator-equivalent group memberships, especially when initiated by non-admin operators.
- Changes to group memberships originating from user-management endpoints rather than group-management endpoints.
- Define alerting on patterns such as:
- A helpdesk or service account suddenly gaining superuser privileges.
- Bulk or repeated additions of users to privileged groups via PATCH/PUT calls.
- Use API gateways or WAFs to enforce additional policy checks on sensitive endpoints, logging and optionally blocking requests that attempt to manipulate privileged group memberships without expected roles or attributes.

