Summary
OpenRemote's rules engine allows authenticated users with the write:rules role to supply JavaScript expressions that are evaluated via ScriptEngine.eval() without sandboxing or class filtering.
Because JavaScript rules execute with full JVM access and Groovy sandboxing is effectively disabled, an attacker can achieve arbitrary code execution on the server and bypass multi-tenant isolation.
Affected context
This vulnerability affects OpenRemote deployments (version 1.21.0 and below) that:
- Expose the rules engine API to users or integrations with the
write:rulesrole - Allow rules to be authored or updated via the platform UI or API
- Run the OpenRemote server with high privileges (often root) and broad filesystem or network access
The issue manifests in the rules engine components that evaluate JavaScript and Groovy rules, where security filters and sandboxing controls are either missing (JavaScript) or improperly wired (Groovy).
Exploit preconditions
- Attack surface: Rules creation and management interface (API or UI) for OpenRemote's rules engine.
- Required access: An authenticated account with the
write:rulespermission; superuser access is not required. - Trigger point: Submission and subsequent execution of a crafted JavaScript (or Groovy) rule that is evaluated by Nashorn's
ScriptEngine.eval()or the Groovy engine. - Why exploitation is possible:
- JavaScript rules are evaluated with
ScriptEngine.eval()without sandboxing, class filtering, or access restrictions, granting full JVM visibility. - Authorization checks restrict Groovy rules to superusers but do not impose similar limits on JavaScript rules.
- The
GroovyDenyAllFilteris defined but never registered because the registration code is commented out, so the intended sandbox is never applied. - As a result, user-supplied expressions can directly reach powerful host APIs, enabling arbitrary code execution.
Why this happens
The core issue is an expression language injection problem where user-supplied scripts are treated as trusted code. In the JavaScript rules engine, Nashorn's ScriptEngine.eval() executes attacker-controlled code without any sandbox, class/package filtering, or API restrictions, matching CWE-94: Improper Control of Generation of Code ('Code Injection').
On the Groovy side, the architecture intends to apply a GroovyDenyAllFilter and SandboxTransformer to constrain what rules can do, but the registration of this filter is commented out. This misconfiguration leaves Groovy rules unsandboxed as well, effectively disabling the intended security boundary. Additionally, incomplete authorization logic in RulesResourceImpl applies stricter controls only to Groovy rules, leaving JavaScript rules broadly accessible to non-superusers with the write:rules role. Together, these design and implementation flaws result in direct execution of untrusted, high-privilege code paths within the JVM.
Potential impact
- Remote code execution as the OpenRemote server process user, often root.
- Arbitrary file read and potential file modification on the server filesystem.
- Theft of environment variables, including database credentials and API keys.
- Complete bypass of multi-tenant isolation, allowing access to data across all realms.
- Lateral movement inside the infrastructure using compromised credentials or host access.
- Full compromise of the OpenRemote platform, including configuration tampering and rule poisoning.
General mitigation guidance
Effective mitigation focuses on eliminating direct evaluation of untrusted expressions and enforcing strict execution boundaries:
- Replace general-purpose
ScriptEngine.eval()and equivalent dynamic execution APIs with controlled rule constructs or a safe DSL that exposes only explicitly allowed operations. - Apply a robust sandbox around any remaining scripting capability, including:
- Whitelisting safe classes, methods, and packages.
- Restricting access to
java.lang, reflection, filesystem, process execution, and network APIs unless explicitly required. - Ensure security filters (such as deny-all or allowlist transformers) are actually registered and enforced in the rules engine initialization path.
- Harden authorization so that powerful rule types or script engines are available only to tightly controlled administrative roles, and consider splitting "business rules edit" from "code execution" capabilities.
- Run the OpenRemote server under a non-root, least-privilege account with constrained filesystem and network permissions to limit blast radius if code execution occurs.
- Reduce trust in tenant-authored rules: treat them as untrusted inputs and design the rules engine to isolate their execution from core platform internals and cross-tenant data.
How teams detect issues like this
Detection should combine code-level analysis with runtime monitoring:
- Static analysis and code review:
- Search backend code for uses of
ScriptEngine.eval(), Groovy shell execution, or similar dynamic evaluation calls that process user-controlled content. - Flag any script engine invocation that lacks explicit sandbox configuration, class filtering, or security manager integration.
- Review rules engine initialization for commented-out or no-op security filter registration and missing checks in authorization layers like
RulesResourceImpl. - Configuration and policy checks:
- Enforce internal development policies that prohibit unsandboxed script execution and require documented security controls for rule evaluation features.
- Validate that rule authoring endpoints are restricted to the minimum required roles and that multi-tenant boundaries are enforced in access control logic.
- Runtime monitoring:
- Enable logging for rule creation, modification, and execution; alert on rules that reference sensitive classes (e.g., filesystem, process, networking, environment access).
- Monitor for unusual outbound connections, file access patterns, or process behavior originating from the OpenRemote server.
- Automated SAST and dependency review tools can assist by flagging dangerous use of expression evaluators and highlighting misconfigurations in security filters, but should be complemented by manual review of rules engine design.

