Summary
OpenRemote's Manager API allows a user with write:admin privileges in one Keycloak realm to modify realm roles for users in other realms, including the master realm.
Because the API trusts the {realm} path segment without verifying that the caller is allowed to administer that realm, an attacker who controls any user in the master realm may escalate to full master realm administrator.
Affected context
This vulnerability occurs in OpenRemote deployments that use Keycloak as an identity provider and rely on the Manager API to manage user roles across realms.
It is relevant where:
- Multiple Keycloak realms are present (e.g., tenant realms plus
master) - Service or administrative users hold
write:adminor similar high-privilege roles in at least one realm - The Manager API is exposed to those users or services for realm and role administration
In such setups, the API uses a {realm} path parameter to perform operations in Keycloak but fails to confirm that the caller is authorized to administer the referenced realm.
Exploit preconditions
- Attack surface: OpenRemote Manager API endpoints that interact with Keycloak realm roles.
- Required access: A valid account or token with
write:admin(or equivalent admin) privileges in any Keycloak realm integrated with OpenRemote. - Cross-realm condition: The attacker's token must be accepted by the Manager API while allowing the caller to specify an arbitrary
{realm}value in the request path. - Trigger point: An API call that updates or manages Keycloak realm roles for users, where the realm is selected via the
{realm}URL segment. - Why exploitation is possible: The Manager API passes the
{realm}value directly to Keycloak when performing role modifications and does not verify that the authenticated caller is authorized to administer that particular realm. This lack of realm-level authorization checks enables role changes in other realms, including themasterrealm, so long as the attacker can also authenticate as or control a user within that target realm.
Why this happens
The core issue is a missing authorization boundary between realms when performing administrative operations.
The Manager API treats the {realm} path segment as a trusted indicator of where to apply role changes, without enforcing that the authenticated principal holds administrative privileges for that specific realm.
This maps to CWE-284: Improper Access Control, where an application fails to enforce an intended authorization policy.
Conceptually, the system conflates "is an admin somewhere" with "is allowed to administer any realm," allowing administrative actions to cross tenant boundaries and affecting higher-privilege realms such as master.
Potential impact
- Attacker may escalate from realm-specific admin to
masterrealm administrator. - Attacker could assign powerful roles (including admin or service-account roles) to accounts they control in other realms.
- Attacker can modify or revoke roles for legitimate users in other realms, impacting availability and integrity of access controls.
- Attacker may create backdoor administrative accounts or tokens, enabling persistent control over identity and access management.
- Compromise of the
masterrealm can lead to full control of all realms, clients, and associated OpenRemote integrations.
General mitigation guidance
Mitigation focuses on enforcing strict, realm-scoped access control for administrative operations and tightening trust boundaries between realms.
Useful patterns include:
- Realm-scoped authorization checks: Ensure that any API call referencing a
{realm}or tenant identifier verifies that the caller holds appropriate admin privileges for that specific realm before performing the operation. - Server-side realm binding: Derive the effective realm for administrative actions from the caller's authenticated context or configuration, rather than from user-controlled path parameters, wherever possible.
- Least privilege for admin roles: Design administrative roles and API tokens to be limited to specific realms, and avoid multi-realm or global admin tokens unless strictly necessary.
- Defense in depth with policy rules: Layer explicit policy checks (e.g., mapping of allowed realms per client or service account) so that even if code-level checks are incomplete, cross-realm escalation attempts are blocked.
- Segregation of high-value realms: Treat
masteror similar global administration realms as highly sensitive; restrict who can administer them and separate their management endpoints or credentials from tenant realms.
How teams detect issues like this
Detection strategies can combine code-level review, configuration analysis, and runtime monitoring:
- Static analysis and code review:
- Flag API handlers that accept realm or tenant identifiers as path or query parameters and then perform administrative operations.
- Look for authorization checks that validate only "is admin" without constraining the scope to the specified realm.
- Review integration layers between application code and identity providers (e.g., Keycloak clients) to ensure they respect realm-scoped permissions.
- Policy and configuration review:
- Inspect service accounts and admin roles to confirm they are limited to specific realms and do not unintentionally have cross-realm powers.
- Enforce policies that bind particular clients or tokens to an explicit set of realms.
- Runtime monitoring:
- Log and monitor calls to realm-administration APIs, capturing which authenticated principal changes roles for which realm.
- Alert on suspicious patterns, such as an admin from one tenant realm modifying roles in the
masterrealm or other unrelated realms. - Automated tooling:
- Use automated security tests or CI checks to simulate cross-realm administrative requests and verify they are rejected.
- Integrate generic access control testing tools that attempt to perform actions across tenant or realm boundaries.

