Jun 19, 2026·7 min read·22 visits
OpenClaw prior to 2026.5.2 loads critical system state paths from untrusted workspace `.env` files, enabling local code execution through dependency path hijacking.
OpenClaw versions prior to 2026.5.2 are vulnerable to an untrusted search path flaw (CWE-426) during workspace initialization. When an operator opens a workspace, the application parses the workspace's local `.env` file and uses the unvalidated `STATE_DIRECTORY` variable to resolve and execute bundled runtime dependencies. An attacker can exploit this to achieve local code execution under the security context of the operator.
OpenClaw is an application platform utilizing a trusted-operator design pattern. This architecture assumes that operators with execution boundaries and plugin management privileges are trusted security actors. However, when operators clone and open external repositories, the attack surface expands to include local configuration files present within the workspace directory.
The vulnerability identified as CVE-2026-53858 is an instance of an untrusted search path vulnerability, classified as CWE-426. The vulnerability occurs during the early parsing phase when OpenClaw opens a new repository or workspace. During this phase, the application processes environment variables defined in local configuration files without proper verification.
By manipulating the STATE_DIRECTORY variable within a repository-specific configuration file, an attacker can override system-defined runtime pathways. This redirection forces the application to load bundled dependencies from the specified local directory rather than the secure, system-defined system state directory. The resulting outcome is arbitrary code execution under the security privileges of the active operator.
The root cause of the flaw lies in the premature evaluation of workspace-level configuration variables before establishing secure runtime boundaries. When an operator loads a workspace, OpenClaw immediately reads and parses the repository's .env file to set up the development context. This parsing routine does not distinguish between user-defined application variables and critical system environment variables.
Specifically, the STATE_DIRECTORY environment variable dictates the directory structure where OpenClaw expects its core execution states and bundled runtime dependencies. When the application engine initializes its dependency resolver, it queries this parsed environment variable to locate its modules. Because the configuration loading process is not isolated, the workspace-level .env file successfully overrides this critical system-level path.
The application subsequently utilizes this unvalidated path to resolve and dynamically import Javascript modules. In Node.js environments, standard module resolution or file system search patterns will traverse the specified folder to find the target modules. This behavior completes the untrusted search path condition, as the application searches an arbitrary directory provided by an external, untrusted source.
The vulnerable path relies on an insecure configuration loader that merges workspace-level .env properties directly into the global process environment. In the vulnerable version, the environment parser reads the local file and applies all key-value pairs directly to process.env without filtering. Below is a representation of the vulnerable configuration sequence:
// Vulnerable configuration sequence in OpenClaw (< 2026.5.2)
const dotenv = require('dotenv');
const path = require('path');
function initializeWorkspace(workspacePath) {
// Vulnerability: Reads local workspace .env and merges it into process.env
dotenv.config({ path: path.join(workspacePath, '.env') });
// Resolves the state path directly from process.env with no validation
const stateDir = process.env.STATE_DIRECTORY || '/var/lib/openclaw';
// Loads dynamic libraries from the unvalidated state directory
const dependencyRoot = path.resolve(stateDir, 'deps');
const coreRuntime = require(path.join(dependencyRoot, 'runtime.js'));
coreRuntime.init();
}In the patched version (2026.5.2), the application introduces an environment variable blocklist and enforces strict isolation of system configuration parameters. Workspace configuration files are parsed into a separate, isolated object, and critical keys such as STATE_DIRECTORY are stripped before any environment merging occurs.
// Patched configuration sequence in OpenClaw (2026.5.2)
const dotenv = require('dotenv');
const path = require('path');
const fs = require('fs');
const SYSTEM_BLOCKED_VARS = ['STATE_DIRECTORY', 'NODE_OPTIONS', 'PATH'];
function initializeWorkspaceSecure(workspacePath) {
const envPath = path.join(workspacePath, '.env');
if (fs.existsSync(envPath)) {
const parsedEnv = dotenv.parse(fs.readFileSync(envPath));
// Mitigation: Filter out system-critical environment variables
for (const key of Object.keys(parsedEnv)) {
if (!SYSTEM_BLOCKED_VARS.includes(key)) {
process.env[key] = parsedEnv[key];
}
}
}
// Resolves the state path strictly from secure system environment or defaults
const stateDir = process.env.STATE_DIRECTORY || '/var/lib/openclaw';
const dependencyRoot = path.resolve(stateDir, 'deps');
// Ensures load path resolves within a trusted system directory
const coreRuntime = require(path.join(dependencyRoot, 'runtime.js'));
coreRuntime.init();
}The patch successfully prevents workspace-level files from manipulating the runtime path. However, security teams must note that other environment-dependent loaders within the application could still be susceptible to similar overrides if third-party configuration libraries are introduced. Complete remediation requires continuous auditing of all path-building operations that rely on external variables.
Exploiting this vulnerability requires an operator to actively open an untrusted repository containing a crafted directory structure and a malicious .env file. The attack payload consists of two primary components: a configuration file setting the STATE_DIRECTORY variable, and a nested directory structure mirroring the expected dependency structure. Below is a structural representation of the exploit delivery:
The attacker defines the STATE_DIRECTORY variable to point to a relative path within the repository, such as ./attacker_libs. Inside this folder, the attacker places a file at deps/runtime.js containing arbitrary JavaScript code. When the victim clones and opens the workspace within OpenClaw, the configuration parser reads the .env file, updates the process environment, and immediately triggers the loading mechanism.
Because the application attempts to resolve runtime.js via the manipulated path, it loads the attacker's script from ./attacker_libs/deps/runtime.js. The payload executes under the same user privileges and system access rights as the active OpenClaw operator process. This bypasses typical access control lists and permits unauthenticated local code execution on the operator's machine.
The impact of successful exploitation is complete system compromise within the execution context of the OpenClaw operator. Since many operators run these environments with high privileges or within development networks, the execution of arbitrary commands provides a beachhead for lateral movement. The attacker can extract environment secrets, steal access tokens, or modify source code files.
The vulnerability is evaluated with a CVSS v4.0 base score of 7.0 and a CVSS v3.1 score of 7.1. The severity is marked as High because it requires minimal complexity and no special administrative permissions to execute. However, user interaction is a strict prerequisite, as the operator must consciously open the malicious directory.
While there are currently no known public exploits or evidence of active exploitation in the wild, the ease of crafting a payload makes this a highly viable vector for targeted supply-chain attacks. The EPSS score remains low at 0.00124, reflecting the lack of public tooling, but organizations should prioritize remediation to secure internal development environments.
The primary and recommended mitigation is upgrading the OpenClaw installation to version 2026.5.2 or later. This release enforces strict validation on environment variables loaded from workspace directories, preventing the overriding of sensitive system-level paths. Systems should be configured to automatically apply patches for core development and runtime utilities.
If immediate patching is not feasible, operators must implement defensive workarounds. One critical workaround is to disable the automatic loading of workspace-level environment configurations in the system preferences. Operators should also manually inspect any .env files in external repositories for variables like STATE_DIRECTORY before opening them.
Additionally, security teams can implement file integrity monitoring and static analysis rules to flag hazardous configurations. Network isolation policies should also be applied to operator workspaces to restrict outbound connections from development platforms, mitigating the impact of code execution by preventing the exfiltration of credentials or the establishment of reverse shells.
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N| Product | Affected Versions | Fixed Version |
|---|---|---|
openclaw OpenClaw | < 2026.5.2 | 2026.5.2 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-426 (Untrusted Search Path) |
| Attack Vector | Local (L) |
| CVSS v3.1 Score | 7.1 (High) |
| EPSS Score | 0.00124 (Percentile: 2.46%) |
| Impact | Local Code Execution (LCE) |
| Exploit Status | None (No public exploit/PoC available) |
| KEV Status | Not Listed |
The application uses an external path or environment variable to search for critical resources without adequately validating the path's integrity.
CVE-2026-77423 is a Regular Expression Denial of Service (ReDoS) vulnerability in the built-in less viewer of the JLine Java library (versions 3.0.0 prior to 3.30.15, and 4.0.0 prior to 4.3.1). The org.jline.builtins.Less class passes user-supplied search and display-filter patterns directly to Java's standard backtracking regular expression engine without complexity validation or execution timeouts. An attacker with access to an interactive JLine session can submit patterns containing nested quantifiers, causing catastrophic backtracking that consumes 100% of a CPU core and blocks the session thread indefinitely. In network-facing deployments such as SSH or Telnet administration consoles, repeated exploitation across concurrent sessions can exhaust bounded worker thread pools and result in a complete denial of service.
CVE-2026-63492 is a rejected CVE identifier originally assigned by GitHub for an OS command injection vulnerability in WWBN AVideo (formerly YouPHPTube) up to version 29.0. It was rejected as a duplicate of the canonical identifier CVE-2026-63304 (tracked under GHSA-j44m-77cc-p3cc). The flaw resides in the listFFmpegProcesses() function within plugin/API/standAlone/functions.php, which interpolates unsanitized user parameters directly into a single-quoted shell pipeline executed via PHP's exec() function. Attackers capable of crafting a valid AES-256-CBC encrypted API payload can break out of the single-quoted context and execute arbitrary operating system commands as the web-server user.
CVE-2026-63476 is an uncontrolled resource consumption vulnerability in isomorphic-git prior to version 1.38.6. When parsing Git packfile delta objects during clone or fetch operations, the applyDelta utility reads an untrusted targetSize integer from the delta stream header and passes it directly to Buffer.alloc(). A malicious remote Git server or man-in-the-middle attacker can supply a delta header specifying a targetSize of approximately 2 GB with minimal actual payload data. Because Buffer.alloc() reserves off-heap memory in Node.js, this bypasses standard V8 heap limits and results in immediate out-of-memory termination or sustained memory retention.
CVE-2026-63410 (GHSA-vp2j-gqfm-r3cf) is a compiler-induced timing side-channel vulnerability in the secp256k1-native Ruby C extension. When compiled with GCC 14.x or 15.x at optimization level -O2, the compiler reconstructs boolean predicates from branchless bitwise multiplexer routines and emits secret-dependent conditional jump instructions (je/jne). During elliptic curve scalar multiplication in the Montgomery ladder, these conditional branches create observable execution timing variations correlated with individual bits of secret private keys or signing nonces.
CVE-2026-133469 is an improper authentication and input type validation vulnerability in the xo-server component of Vates Xen Orchestra and Xen Orchestra Appliance (XOA). Due to Express cookie-parser JSON deserialization combined with loose truthiness validation and unvalidated Redis query construction, an unauthenticated attacker can supply an empty JSON object cookie (authenticationToken=j:{}) to bypass authentication and hijack the first valid active session token stored in the database. This flaw is actively exploited in the wild to gain administrative control over Xen Orchestra deployments and execute root-level commands on underlying XCP-ng and XenServer hypervisors.
CVE-2026-22816 (GHSA-w78c-w6vf-rw82) is a high-severity flaw in Gradle's dependency resolution engine affecting versions prior to 8.14.4 and versions 9.0.0 through 9.2.1. Due to improper error handling when transient network errors or connection failures exhaust their retry limits, Gradle fails to mark unreachable repositories as disabled and does not abort the resolution queue. Instead, it silently falls through to subsequent repositories configured in the build script. This behavior enables dependency confusion and supply chain attacks when an internal or primary repository experiences connectivity issues, unresolvable DNS, or domain registration lapses.