CVE-2026-31997: OpenClaw: post-approval PATH rebind enables arbitrary RCE
MEDIUMOpenClaw before 2026.3.1 contains a time-of-check/time-of-use flaw in its system.run approval gate: when an operator approves a bare token (non-path argv[0]) rather than an absolute binary path, executable identity is not pinned at approval time, allowing an attacker with local low-privilege access to manipulate PATH after approval and substitute a malicious binary before execution fires. Despite a medium CVSS of 6.0 and low raw EPSS score (0.00091), the confidentiality and integrity impact upon successful exploitation is rated HIGH — meaning the agent's full process context, including any credentials, configuration, or connected infrastructure it can reach, is exposed. OpenClaw already carries 396 published CVEs and its skill ecosystem has seen confirmed malicious abuse leading to credential theft in the wild (AIID #1368), establishing that this package's execution surface is an active target. Upgrade to OpenClaw 2026.3.1 immediately; where patching is delayed, enforce absolute paths in all system.run approvals and restrict PATH to root-owned, immutable directories.
What is the risk?
Practical exploitability is constrained by three factors: local access requirement, high attack complexity (TOCTOU timing window), and mandatory operator interaction for the approval trigger. However, once those preconditions align, the impact is severe — C:H/I:H with no scope change. OpenClaw's accumulated CVE history (396 prior disclosures), confirmed ecosystem-level abuse in the wild, and the structural insecurity of token-based approval without executable identity pinning collectively elevate this beyond its nominal CVSS 6.0 surface rating for any organization running OpenClaw agents with system.run enabled. The attack requires no AI/ML expertise — only knowledge of PATH resolution and a brief timing window.
How does the attack unfold?
What systems are affected?
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| OpenClaw | pip | — | No patch |
Do you use OpenClaw? You're affected.
How severe is it?
What is the attack surface?
What should I do?
6 steps-
Patch: upgrade OpenClaw to 2026.3.1 or later, which pins executable identity at approval time.
-
Workaround if patching is delayed: enforce a policy requiring absolute paths for all system.run approvals — reject any bare token argv[0] entries at the configuration level.
-
Harden PATH: prior to agent execution, restrict PATH to root-owned, immutable directories to prevent post-approval prepending of attacker-controlled entries.
-
Audit: review all existing system.run approval entries for non-path-like tokens and revoke them.
-
Least privilege: run OpenClaw agent processes under OS accounts with minimal PATH exposure and restricted write access to directories on PATH.
-
Detection: monitor process execution logs for unexpected binary invocations under the OpenClaw process tree, particularly for common interpreter names (python, node, sh) launched from non-standard paths.
What does CISA's SSVC say?
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
How is it classified?
Which compliance frameworks are affected?
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2026-31997?
OpenClaw before 2026.3.1 contains a time-of-check/time-of-use flaw in its system.run approval gate: when an operator approves a bare token (non-path argv[0]) rather than an absolute binary path, executable identity is not pinned at approval time, allowing an attacker with local low-privilege access to manipulate PATH after approval and substitute a malicious binary before execution fires. Despite a medium CVSS of 6.0 and low raw EPSS score (0.00091), the confidentiality and integrity impact upon successful exploitation is rated HIGH — meaning the agent's full process context, including any credentials, configuration, or connected infrastructure it can reach, is exposed. OpenClaw already carries 396 published CVEs and its skill ecosystem has seen confirmed malicious abuse leading to credential theft in the wild (AIID #1368), establishing that this package's execution surface is an active target. Upgrade to OpenClaw 2026.3.1 immediately; where patching is delayed, enforce absolute paths in all system.run approvals and restrict PATH to root-owned, immutable directories.
Is CVE-2026-31997 actively exploited?
No confirmed active exploitation of CVE-2026-31997 has been reported, but organizations should still patch proactively.
How to fix CVE-2026-31997?
1. Patch: upgrade OpenClaw to 2026.3.1 or later, which pins executable identity at approval time. 2. Workaround if patching is delayed: enforce a policy requiring absolute paths for all system.run approvals — reject any bare token argv[0] entries at the configuration level. 3. Harden PATH: prior to agent execution, restrict PATH to root-owned, immutable directories to prevent post-approval prepending of attacker-controlled entries. 4. Audit: review all existing system.run approval entries for non-path-like tokens and revoke them. 5. Least privilege: run OpenClaw agent processes under OS accounts with minimal PATH exposure and restricted write access to directories on PATH. 6. Detection: monitor process execution logs for unexpected binary invocations under the OpenClaw process tree, particularly for common interpreter names (python, node, sh) launched from non-standard paths.
What systems are affected by CVE-2026-31997?
This vulnerability affects the following AI/ML architecture patterns: agent frameworks, agentic workflows with tool execution, local AI agent deployments with operator approval workflows.
What is the CVSS score for CVE-2026-31997?
CVE-2026-31997 has a CVSS v3.1 base score of 6.0 (MEDIUM). The EPSS exploitation probability is 0.09%.
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0011 User Execution AML.T0050 Command and Scripting Interpreter AML.T0053 AI Agent Tool Invocation AML.T0074 Masquerading Compliance Controls Affected
What are the technical details?
Original Advisory
OpenClaw versions prior to 2026.3.1 fail to pin executable identity for non-path-like argv[0] tokens in system.run approvals, allowing post-approval executable rebind attacks. Attackers can modify PATH resolution after approval to execute a different binary than the operator approved, enabling arbitrary command execution.
Exploitation Scenario
An attacker with low-privilege local access on a host running an OpenClaw agent waits for or engineers a workflow that prompts an operator to approve a system.run command using a bare token — for example, 'python' to invoke a data processing script. The operator approves the command via the UI. In the window between approval and execution, the attacker prepends a writable directory (e.g., /tmp/evil) containing a malicious binary named 'python' to the PATH environment variable for the agent process. When system.run fires, OpenClaw resolves 'python' via the now-manipulated PATH and executes the attacker's binary instead of the legitimate interpreter, achieving arbitrary code execution under the agent's privilege context — potentially exfiltrating API keys, model configuration, or accessing connected AI infrastructure.
Weaknesses (CWE)
CWE-367 — Time-of-check Time-of-use (TOCTOU) Race Condition: The product checks the state of a resource before using that resource, but the resource's state can change between the check and the use in a way that invalidates the results of the check.
- [Implementation] The most basic advice for TOCTOU vulnerabilities is to not perform a check before the use. This does not resolve the underlying issue of the execution of a function on a resource whose state and identity cannot be assured, but it does help to limit the false sense of security given by the check.
- [Implementation] When the file being altered is owned by the current user and group, set the effective gid and uid to that of the current user and group when executing this statement.
Source: MITRE CWE corpus.
CVSS Vector
CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:N References
Timeline
Related Vulnerabilities
CVE-2026-33579 9.9 OpenClaw: scope bypass escalates low-priv to admin
Same package: openclaw CVE-2026-32922 9.9 OpenClaw: privilege escalation to RCE via token scope bypass
Same package: openclaw CVE-2026-30741 9.8 OpenClaw: RCE via request-side prompt injection
Same package: openclaw CVE-2026-32038 9.8 OpenClaw: sandbox bypass enables container lateral movement
Same package: openclaw CVE-2026-53838 9.8 OpenClaw: approval scope bypass via reconnection state
Same package: openclaw