{"id":"CVE-2026-41166","aliases":["CVE-2026-41166","GHSA-49vv-25qx-mg44"],"related":[],"kind":"vulnerability","state":"published","title":"OpenRemote has Improper Access Control via updateUserRealmRoles function","summary":"OpenRemote is an open-source internet-of-things platform. Prior to version 1.22.1, a user who has `write:admin` in one Keycloak realm can call the Manager API to update Keycloak realm roles for users in another realm, including `master`. The handler uses the `{realm}` path segment when talking to the identity provider but does not check that the caller may administer that realm. This could result in a privilege escalation to `master` realm administrator if the attacker controls any user in `master` realm. Version 1.22.1 fixes the issue.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"OpenRemote is an open-source internet-of-things platform. Prior to version 1.22.1, a user who has `write:admin` in one Keycloak realm can call the Manager API to update Keycloak realm roles for users in another realm, including `master`. The handler uses the `{realm}` path segment when talking to the identity provider but does not check that the caller may administer that realm. This could result in a privilege escalation to `master` realm administrator if the attacker controls any user in `master` realm. Version 1.22.1 fixes the issue.","source":"cvelist"},{"lang":"en","text":"### Summary\nA user who has `write:admin` in one Keycloak realm can call the Manager API to update **Keycloak realm roles** for users in **another** realm, including **`master`**. The handler uses the `{realm}` path segment when talking to the identity provider but does not check that the caller may administer that realm. This could result in a privilege escalation to `master` realm administrator if the attacker controls any user in `master` realm.\n\n### Details\nIn `manager/src/main/java/org/openremote/manager/security/UserResourceImpl.java`, there is no check to validate if the caller should be able to administer a realm they're trying to update.\n\n```340:353:manager/src/main/java/org/openremote/manager/security/UserResourceImpl.java\n    @Override\n    public void updateUserRealmRoles(RequestParams requestParams, String realm, String userId, String[] roles) {\n        try {\n            identityService.getIdentityProvider().updateUserRealmRoles(\n                realm,\n                userId,\n                roles);\n        } catch (ClientErrorException ex) {\n            ex.printStackTrace(System.out);\n            throw new WebApplicationException(ex.getCause(), ex.getResponse().getStatus());\n        } catch (Exception ex) {\n            throw new WebApplicationException(ex);\n        }\n    }\n```\n\n### PoC\n1. Create a **new** Keycloak realm other than `master`. Add a user and grant that user the OpenRemote client role `write:admin`. Remember the realm name (call it `NEW_REALM`).\n2. In Keycloak realm `master`, pick a **low-privilege** user (no `admin` realm role). Copy that user’s UUID (`<master-user-uuid>`).\n3. Authenticate as the user from step 1 and obtain a Bearer access token (`<token>`) for `NEW_REALM`.\n4. Replace placeholders and run:\n```bash\ncurl -k -X PUT \"https://<host>/api/<NEW_REALM>/user/master/userRealmRoles/<master-user-uuid>\" \\\n  -H \"Authorization: Bearer <token>\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '[\"admin\"]'\n```\n5. In the Keycloak Admin Console, realm master, that user, Role mapping. Confirm the admin realm role is assigned.\n### Impact\nAn attacker with the OpenRemote client role write:admin in any realm can call this API with {realm} set to another realm (for example master) and change Keycloak realm roles for users there. That can grant admin on master to a user UUID they target, which gives Keycloak administrator access for the master realm.","format":"markdown","source":"ghsa"},{"lang":"es","text":"OpenRemote es una plataforma de internet de las cosas de código abierto. Antes de la versión 1.22.1, un usuario que tiene ’write:admin’ en un reino de Keycloak puede llamar a la API del Gestor para actualizar los roles del reino de Keycloak para usuarios en otro reino, incluyendo ’master’. El gestor utiliza el segmento de ruta ’{realm}’ al comunicarse con el proveedor de identidad, pero no verifica que el llamante pueda administrar ese reino. Esto podría resultar en una escalada de privilegios a administrador del reino ’master’ si el atacante controla a cualquier usuario en el reino ’master’. La versión 1.22.1 corrige el problema.","source":"nvd"}],"published":"2026-04-22T14:38:23.000Z","modified":"2026-11-11T23:10:00.263Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:L","score":7,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:L","score":7,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:L","score":7,"rating":"HIGH"}],"cwes":["CWE-284"],"affected":[{"ranges":[{"version":"< 1.22.1","status":"affected"}],"vendor":"openremote","product":"openremote","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.22.1"}],"ecosystem":"Maven","package":"io.openremote:openremote-manager","purl":"pkg:maven/io.openremote/openremote-manager","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"1.22.1"}],"vendor":"openremote","product":"openremote","cpe":"cpe:2.3:a:openremote:openremote:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/openremote/openremote/security/advisories/GHSA-49vv-25qx-mg44","tags":["exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/openremote/openremote/releases/tag/1.22.1","tags":["product","release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-41166","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/openremote/openremote","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"total","date":"2026-04-24T00:00:00.000Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-41166","url":"https://www.cve.org/CVERecord?id=CVE-2026-41166","licence":"CVE Terms of Use","modified":"2026-04-28T03:55:21.242Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-49vv-25qx-mg44","url":"https://github.com/advisories/GHSA-49vv-25qx-mg44","licence":"CC-BY-4.0","modified":"2026-05-05T16:00:53.382Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-41166","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-41166","licence":"Public domain","modified":"2026-11-11T23:10:00.263Z"}],"updatedAt":"2026-11-25T22:59:19.354Z","epss":{"score":0.00296,"percentile":0.23978,"date":"2026-12-01T12:00:22.000Z"}}