Stored XSS in Map asset marker lets a realm asset writer act as a superuser and reach Groovy rules
Description
A user with write:assets in a realm can store a TEXT direction value on a located ThingAsset. The manager Map page takes that value as a rotation number, interpolates it into a marker's HTML style attribute, and assigns the string to innerHTML. The same template inserts the marker label (displayValue), the value of the attribute the map is configured to show on markers, into that HTML unescaped. Markup in either value consequently executes in the manager origin when a victim views the marker. In the measured same-realm scenario, a superuser opened the Map page and continued using that tab. The script observed an Authorization header sent by the app and used the superuser session to create an enabled GROOVY realm ruleset. The ruleset ran in the manager JVM; a separate benign command variant showed OS command execution as uid 0 inside the manager container. The fixable vulnerability is the marker rendering. Groovy execution is a sanctioned superuser feature that the XSS reaches through the victim's authority.
Severity
CVSS 3.1: CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H = 9.0 Critical. CVSS 4.0: CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:H/VI:H/VA:H/SC:L/SI:L/SA:N = 8.6 High. PR:L represents a realm asset writer, without realm admin or write:rules. UI:R/UI:P represents a superuser opening that realm's Map page and continuing to use the tab. For CVSS 3.1, the browser script crosses into the superuser's security authority and the server, consistent with FIRST's changed-scope stored-XSS example 16 (CVE-2019-7551). The high vulnerable-system impacts reflect manager-wide superuser authority and the measured Groovy execution. For CVSS 4.0, the subsequently affected browser session is scored SC:L/SI:L/SA:N. High impact on a distinct subsequent system, such as an agent-connected device or identity provider, was not demonstrated; a 9.4 vector claiming SC/SI/SA:H is not asserted.
Affected versions
<= 1.34.1. The marker template dates from #578 (2022) and the marker XSS reproduces on 1.2.0, so no lower bound is given.
Root cause and measured route
ui/component/or-map/src/markers/or-map-marker-asset.ts stringifies asset.attributes[WellknownAttributes.DIRECTION].value and, when the marker config enables labels, formats the configured attribute as displayValue. _defaultTemplate in ui/component/or-map/src/markers/or-map-marker.ts interpolates the direction into style="transform: rotate(${options.direction}deg)" and displayValue into the label <span>, then _createDefaultMarkerContent assigns that HTML to div.innerHTML. Only ShipAsset declares a typed direction descriptor (ValueType.DIRECTION, integer 0–360); the ThingAsset used in the test accepts the client-supplied TEXT type. The tested value was stored and read back byte-for-byte.
The attacker account held only read:assets and write:assets client roles and no realm admin role. Its create and update requests returned 200. A read-only account and an anonymous request got 403 for the same update. The superuser logged in through the normal Keycloak form, opened the master realm's Map page, and the browser observed the injected marker. The injected page code's same-origin POST /api/master/rules/realm returned 200; its Groovy body wrote a benign file under /storage. A separate container replayed the captured browser token and received 200 for another benign ruleset, while the same request without that token returned 403. A subsequent ruleset variant ran an innocuous identity command and recorded uid=0(root) inside the manager container. These are container-process rights; no host execution is claimed.
Reproduction outline
- On an isolated OpenRemote instance running 1.34.1 or earlier, grant a test account
read:assetsandwrite:assetsbut no realmadminor rules roles. Create a locatedThingAssetin the realm the superuser will view. - Update its
directionattribute through the asset API as TEXT with a harmless marker event handler that only sets an in-page test flag. Read the asset back and compare the value exactly. Repeat the write as a read-only user and anonymously; both should be refused. - Have a superuser log in normally and open that realm's Map page. The marker template should produce the test flag in the manager origin. For the authorization consequence, continue using that tab and observe that its own API requests carry the superuser Authorization header. A benign enabled GROOVY realm ruleset created from that page succeeds; the same creation from the asset writer's session is refused.
- For the label, configure the Map page markers, or a dashboard Map widget, to show labels for a TEXT attribute of
ThingAsset, and set that attribute to the same markup. Viewing the marker produces the test flag.
Limits and configuration
The victim must open the affected realm's Map page (the manager's default page) and keep using the tab until the application sends a request. A superuser switching to an attacker's tenant realm, a restricted user's linked-asset route, and a victim who never makes a later request were not tested. Default clustering is enabled (180 px radius, maximum zoom 17) and a clustered asset renders no individual marker, so placement in a populated realm matters; no success rate in populated realms is claimed. The label route also requires a map or dashboard Map widget configured to show labels for an attribute the attacker can write. The manager returns no Content-Security-Policy header, and the default openremote/proxy image adds none. A deployment adding a CSP that blocks inline handlers can block this route. Setting OR_RULES_GROOVY_EXECUTION_ENABLED=false removes the OS-command step, but the effect on superuser takeover through other APIs was not dynamically checked.
Suggested fix
Treat direction and the label as data when building the marker: convert direction to a finite number before using it as a rotation, and build the marker content without interpolating values into HTML assigned to innerHTML, so the label renders as text. The root flaw to fix here is the marker rendering, not the superuser-only Groovy feature.