Summary
OneUptime's custom JavaScript monitor feature executes user-supplied code using Node.js's vm module, which is not a security boundary and permits trivial sandbox escape.
When combined with default open registration and low-role access to monitor creation, an attacker can run arbitrary code with access to host networking and all cluster credentials, leading to rapid full-environment compromise.
Affected context
This vulnerability appears in OneUptime deployments that:
- Enable the custom JavaScript monitor feature
- Execute user-provided JavaScript on backend probes using Node.js's
vmmodule - Run probes with host networking and sensitive credentials exposed via environment variables
- Allow self-service or open registration, where the baseline role (e.g., ProjectMember) is permitted to create monitors
In such environments, user-supplied monitor code is effectively treated as trusted logic despite originating from low-trust or anonymous users.
Exploit preconditions
- Attack surface: Public web interface / API for creating custom JavaScript monitors.
- Required access: Ability to sign up as a user in a project (open registration enabled by default) and obtain the lowest role that can create monitors (ProjectMember).
- Trigger point: Saving or executing a custom JavaScript monitor causes the backend probe to run attacker-controlled code inside a Node.js
vmcontext. - Why exploitation is possible:
- The Node.js
node:vmmodule is used as if it provides isolation, but it is explicitly not a security sandbox. - Well-known one-liner patterns allow immediate escape from the
vmcontext to the underlying process. - The probe process runs with host networking and exports highly privileged secrets (e.g.,
ONEUPTIME_SECRET,DATABASE_PASSWORD,REDIS_PASSWORD,CLICKHOUSE_PASSWORD) as environment variables. - As a result, arbitrary code execution occurs with full access to the runtime environment and the surrounding cluster.
Why this happens
The core issue is treating a non-security mechanism (node:vm) as a secure sandbox for untrusted code.
From a vulnerability-class perspective, this maps to CWE-94: Improper Control of Generation of Code (Code Injection), because the system directly executes user-provided JavaScript as part of its normal operation without a true isolation boundary. The design assumes that vm can contain or limit the behavior of untrusted code, but the API is not meant to enforce security constraints. Consequently:
- Untrusted code is granted execution within the same process as trusted logic.
- The code can trivially access process-level constructs (e.g.,
process,require, global objects) using well-known escape techniques. - Once the attacker reaches the real Node.js runtime, they can read environment variables, initiate network connections, or interact with the filesystem.
Conceptually, the bug is an insecure execution environment: untrusted code is executed as if it were confined, but in reality it runs with the full authority of the service.
Potential impact
- Remote execution of arbitrary OS-level commands via Node.js primitives.
- Exfiltration of all cluster credentials stored in environment variables (e.g., application secrets, database, Redis, ClickHouse credentials).
- Full compromise of the OneUptime monitoring cluster, including configuration, stored data, and future telemetry.
- Lateral movement into connected services and databases using stolen credentials.
- Persistent backdoors, data manipulation, or log tampering through the compromised monitoring infrastructure.
- Abuse of host networking to pivot into internal-only services or perform internal scanning.
General mitigation guidance
Effective mitigation centers on eliminating the execution of untrusted code in non-hardened environments and enforcing strict privilege boundaries:
- Avoid treating
node:vmor similar runtime features as security sandboxes. If untrusted code must be supported, execute it in separate, unprivileged, and tightly isolated processes or containers with narrowly scoped capabilities. - Apply principle of least privilege to probe components:
- Remove unnecessary host networking where possible.
- Restrict environment variables and secrets exposed to the monitoring runtime.
- Use dedicated, minimally privileged credentials for each subsystem instead of cluster-wide secrets.
- Introduce capability-based controls for user-defined scripts:
- Limit which roles can define or modify executable monitors.
- Require administrative approval or review for arbitrary code monitors.
- Prefer declarative, configuration-driven checks over free-form scripting where feasible.
- Implement strong multi-tenant isolation so that compromise of one project's scripts does not grant access to global or cross-tenant resources.
- Provide safer alternatives for extensibility, such as predefined templates, domain-specific languages (DSLs), or restricted, validated expressions instead of arbitrary JavaScript.
How teams detect issues like this
Detection should focus on both proactive code analysis and runtime monitoring:
- Static analysis and code review:
- Flag any use of
node:vm,eval,Function, or similar dynamic execution primitives that process user-controlled input. - Identify code paths where user-supplied monitor definitions are stored and later executed server-side.
- Enforce review policies requiring security sign-off for features that execute user-provided logic.
- Automated tooling:
- Use static application security testing (SAST) tools configured with rules to detect dangerous JavaScript execution patterns and untrusted-code execution.
- Integrate custom linting rules into CI pipelines to prevent reintroduction of unsandboxed script execution.
- Runtime and operational signals:
- Monitor probe processes for unusual outbound network connections or unexpected destinations.
- Log and inspect high-risk monitor definitions, especially those containing dynamic imports, filesystem access attempts, or environment variable access.
- Track account creation rates and unusual patterns of monitor creation that might indicate automated exploitation attempts.
- Policy enforcement:
- Apply organizational rules that prohibit running untrusted user code in privileged components.
- Periodically audit services that advertise "custom scripting" or "user-defined logic" for proper isolation controls.

