/

CVE-2026-41166

Severity:

HIGH RISK

(7.0)

Improper Access Control in OpenRemote Manager–Keycloak

CVE-2026-41166

Analyzed

Vulnerability type

Category:

Improper Access Control

CWE:

CWE-284

Impact:

Privilege Escalation to Administrative Access

Severity:

HIGH RISK

(7.0)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

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:admin or 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 the master realm, 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 master realm 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 master realm 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 master or 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 master realm 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.

Sources

SourceLink
github.comgithub.com/openremote/openremote/releases/tag/1.22.1
github.comgithub.com/openremote/openremote/security/advisories/GHSA-49vv-25qx-mg44

Frequently asked

questions

Yes, if the Manager API is network-accessible and an attacker can obtain or control credentials with write:admin-level access in any realm, they can attempt to issue cross-realm role modification requests.

The attacker needs a valid account or token with administrative write privileges in at least one Keycloak realm integrated with OpenRemote.

They also need control over or access to a user account in the target realm (such as master) to elevate that account's roles.

Apply strict realm-scoped access control: every operation that references a realm should verify that the caller is authorized to administer that specific realm, or derive the realm automatically from the caller's authenticated context rather than trusting user input.

Adopt a consistent authorization model that:

  • Explicitly associates admin permissions with a scope (realm, tenant, project).
  • Avoids using user-supplied identifiers to select administrative scope without additional checks.
  • Includes security review and automated tests focusing on cross-tenant and cross-realm boundaries, particularly around identity provider integrations and role management APIs.
Find out what's already
exploitable in your codebase.