You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Admin REST API: Insufficient default restrictions on protocol mapper configuration by privileged client administrators #50588
Keycloak's protocol mapper system allows privileged users with client management capabilities (manage-clients, FGAv2 delegated admins, dynamic client registration, CIMD) to configure dangerous mappers — such as direct claim, custom audience, custom role, and script mappers — without any default restrictions. These mappers can manipulate tokens to target other applications or escalate permissions within the realm.
Client policies exist as a mitigation mechanism but are not enabled by default and do not cover all endpoints (e.g., client scope assignment can bypass client policies). Client registration policies only enforce during the registration flow, not on Admin REST API operations.
This is a broad hardening issue encompassing multiple attack vectors. The single concrete exploitable vector — privilege escalation via hardcoded role mapper injection from manage-clients to realm-admin.
Version affected
All current versions (reported against development branch). The architectural gap has existed since protocol mappers were introduced.
Expected behavior
Dangerous protocol mappers (direct claim, custom audience, custom role, script mapper) should have default restrictions or require explicit opt-in for non-realm-admin users.
Client policies should enforce on all client management endpoints, including Admin REST API and client scope assignment.
Not all client scopes should be available to all clients by default.
Script mappers should have additional restrictions given their ability to execute arbitrary code.
Actual behavior
All protocol mappers are available to any user with client management privileges, with no default restrictions.
Client registration policies only enforce during OIDC/SAML registration flows, not Admin REST API calls.
Client policies can be bypassed by directly mapping a client scope to a client.
Script mappers are available without additional authorization checks.
Steps to reproduce
Assign manage-clients role to a user (or configure FGAv2 delegated client admin).
Using the Admin REST API, create or update a client with a hardcoded-role protocol mapper pointing to a privileged role (e.g., realm-admin).
Authenticate as the client's service account.
Observe the token contains the escalated role without any policy enforcement blocking the mapper configuration.
This issue was originally tracked in the private repository. Migrated by @abstractj.
Activity
mposolda commentedon Oct 15, 2026
Related issue for documentation update: #54010 (warning to the documentation about the fact that client administrator can assign any client scope)