CVE-2026-53858: OpenClaw: Workspace .env STATE_DIRECTORY could influence bundled runtime dependency roots
OpenClaw before 2026.5.2 lets a workspace `.env` file set `STATE_DIRECTORY` before it resolves the roots for its bundled runtime dependencies. If an operator opens a malicious repository, OpenClaw can load those dependencies from an attacker-chosen local path, which leads to code execution. Fixed in 2026.5.2.
Published Jun 18, 2026 · Analysis Oct 26, 2026
What an attacker can do
OpenClaw installs and loads bundled runtime dependencies from a state directory. In affected versions, a .env file in the opened workspace could define STATE_DIRECTORY early enough to change where that lookup points. This is an untrusted search path flaw (CWE-426).
The attacker needs a repository that the operator opens, with a crafted .env and a directory of planted dependencies reachable on the local machine. The CVSS vectors reflect that: local attack vector, user interaction required, and high confidentiality and integrity impact. If the planted code loads, it runs with the operator's rights, so SSH keys, tokens and source code are exposed.
A shared checkout, a cloned pull request branch or a downloaded sample project are the realistic delivery routes. The advisory keeps the trusted-operator model: the operator is trusted, but the contents of a repository they open are not.
Who is affected
The npm package openclaw before 2026.5.2. Exposure needs OpenClaw to resolve runtime dependency roots while a workspace .env from an untrusted repository is in effect. Check the version:
npm ls openclawAlso search workspaces for .env files that set STATE_DIRECTORY.
openclaw
- Ecosystem
- npm
- Affected
- < 2026.5.2
- Fixed in
- 2026.5.2
- Check
npm ls openclaw
How to fix it
Upgrade to openclaw 2026.5.2, the first stable patched version:
npm install [email protected]Until then, do not open untrusted workspace env files before runtime dependency installation. Keep channel and tool allowlists narrow, do not share one Gateway between mutually untrusted users, and disable the affected feature if you do not need it.
How to tell if you were hit
Grep repositories you opened with OpenClaw for .env files containing STATE_DIRECTORY. Check that the state directory OpenClaw uses is your normal one, and look for unexpected node_modules or dependency folders in the path a .env points to. Beam records agent file access and shell commands, so reads of a new .env from a freshly cloned repository can be flagged by its rules.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Summary
Workspace .env STATE_DIRECTORY could influence bundled runtime dependency roots. In affected versions, a workspace .env in a repository opened by a trusted operator could set STATE_DIRECTORY before runtime dependency root resolution.
This advisory is scoped to the named feature and configuration. It does not change OpenClaw's trusted-operator model: authenticated Gateway operators, installed plugins, and intentional local execution surfaces remain trusted unless a separate policy, approval, allowlist, sandbox, or auth boundary is crossed.
Impact
When the affected feature is enabled and reachable, this could load bundled runtime dependencies from an unintended local state path. Practical impact depends on the operator's configuration and whether lower-trust input can reach that path.
Patched Versions
The first stable patched version is 2026.5.2.
Mitigations
avoid opening untrusted workspace env files before runtime dependency installation until patched. As general hardening, keep channel and tool allowlists narrow, avoid sharing one Gateway between mutually untrusted users, and disable the affected feature when it is not needed.
Credited to feynman-hou.
Questions
- Is a malicious repository enough to trigger CVE-2026-53858?
The repository must contain a
.envthat setsSTATE_DIRECTORY, and the operator must open it. The attacker also needs dependencies at the path it names. The CVSS vector requires user interaction.- Which version fixes it?
openclaw 2026.5.2. Earlier versions are affected.
- Is it a remote attack?
No. The CVSS vectors give a local attack vector. The attacker's input arrives through a workspace file.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
More OpenClaw vulnerabilities
All OpenClaw entriesCVE-2026-62197
OpenClaw: Browser CDP discovery could accept blocked WebSocket URLs
medium8.5Oct 21, 2026CVE-2026-35630
OpenClaw: QQBot native approval buttons did not enforce configured approver identity
high8.0Jul 2, 2026CVE-2026-53806
OpenClaw: Combined POSIX shell options could confuse exec revalidation
high8.8Jul 2, 2026CVE-2026-53809
OpenClaw: Embedded runner policy could be confused by provider aliases
medium3.8Jul 2, 2026CVE-2026-53810
OpenClaw's marketplace runtime extension metadata could point at unscanned payloads
high8.8Jul 2, 2026CVE-2026-53811
OpenClaw: Matrix allowFrom could bind to mutable display names
high8.8Jul 2, 2026
