CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-F7WW-2725-QVW2
High

GHSA-F7WW-2725-QVW2: TOCTOU Approval Bypass in OpenClaw via Symlink Rebinding

Amit Schendel
Amit Schendel
Senior Security Researcher

Mar 3, 2026·6 min read·4 visits

PoC Available

Executive Summary (TL;DR)

OpenClaw versions prior to 2026.2.26 contain a race condition in the command approval mechanism. Attackers can gain unauthorized filesystem access by swapping symbolic links in the target directory path after an administrator grants approval but before the command executes. This bypasses security controls intended to restrict agent behavior.

A high-severity Time-of-Check Time-of-Use (TOCTOU) vulnerability exists in the OpenClaw AI assistant framework, specifically within the `system.run` command approval workflow. The flaw allows local attackers or compromised sub-processes to bypass administrator approval restrictions by manipulating symbolic links in the Current Working Directory (CWD) path. By altering filesystem state between the approval phase and the execution phase, an attacker can redirect command execution to unauthorized, sensitive directories (e.g., `/root` or `/etc`) despite the administrator approving a benign path.

Vulnerability Overview

OpenClaw acts as an autonomous agent capable of executing system commands via the system.run interface. To maintain security, the framework implements a 'Gateway' pattern where sensitive operations requested by a Node (agent) must be explicitly approved by a human administrator or a policy engine. This approval process relies on inspecting the parameters of the request, specifically the command arguments (argv) and the working directory (cwd).

The vulnerability stems from a Time-of-Check Time-of-Use (TOCTOU) discrepancy in how file paths are handled during this workflow. The system validates the cwd path as a string during the approval phase. However, it does not ensure that the filesystem objects referenced by that path remain static until execution. In a Linux/Unix environment, paths containing symbolic links are resolved dynamically by the kernel at the moment of access. If an attacker can modify the symlink targets after approval is granted, the validation logic becomes irrelevant.

This flaw undermines the core security model of OpenClaw, effectively allowing an agent or a local attacker to trick an administrator into authorizing execution in a sandbox environment, only to have the execution actually occur in a privileged or sensitive directory. This is classified as an Authorization Bypass via Race Condition (CWE-367).

Root Cause Analysis

The root cause is the lack of atomicity between the path validation step and the process instantiation step, combined with the presence of mutable symbolic links in the path components. When system.run is invoked, the path is presented to the approver. The approver evaluates the risk based on the path's resolution at that moment. Once approved, the system queues the command for execution.

The execution engine eventually calls the operating system's process spawn primitives (e.g., execve or Node.js child_process.spawn), passing the originally approved string as the cwd. The OS resolves this path at the instant of execution. If any component of that path is a symbolic link that has been modified since the approval, the final destination of the cwd changes.

Specifically, the vulnerability exploits the gap between the Check (Approval) and the Use (Execution). Because the system did not lock the filesystem state or enforce the use of a pre-resolved file descriptor, the path name is merely a pointer that can be retargeted. This is particularly dangerous when the path traverses directories where the attacker has write permissions, allowing them to replace a symlink with a new one pointing to a restricted location.

Code Analysis

The remediation involves two major architectural changes: creating immutable execution plans and strictly validating path components for mutable symlinks. The fix was introduced in version 2026.2.26.

Vulnerable Logic (Conceptual): Previously, the system likely accepted a request object, displayed it to the user, and upon approval, passed that same object to the execution handler. There was no verification that the path components were immutable.

Patched Logic: The fix introduces hasMutableSymlinkPathComponentSync, which recursively checks every segment of the target path. It ensures that no component is a symbolic link residing in a writable directory. If a path relies on a symlink that the current process user can modify (delete/recreate), it is rejected as unsafe.

Below is the critical validation logic added in src/node-host/invoke-system-run-plan.ts (Commit 78a7ff2d50fb3bcef351571cb5a0f21430a340c1):

// Validation: Ensure no component of the path is a mutable symlink
function hasMutableSymlinkPathComponentSync(targetPath: string): boolean {
  // Iterate through every directory component from root to target
  for (const component of pathComponentsFromRootSync(targetPath)) {
    try {
      // Check if the component is a symlink
      if (!fs.lstatSync(component).isSymbolicLink()) {
        continue;
      }
      // If it is a symlink, check if the PARENT directory is writable
      const parentDir = path.dirname(component);
      if (isWritableByCurrentProcessSync(parentDir)) {
        return true; // REJECT: Attacker could swap this link
      }
    } catch {
      return true; // Fail closed on error
    }
  }
  return false;
}

Additionally, the system now uses a systemRunPlanV2 object (Commit 4b4718c8dfce2e2c48404aa5088af7c013bed60b). This plan is generated during a prepare phase where paths are canonicalized. The execution phase strictly adheres to the prepared plan, rejecting any late-bound parameters that differ from the approved plan.

Exploitation Methodology

Exploiting this vulnerability requires the attacker to have write access to a directory used in the cwd path of a requested command. The attack follows a standard race condition pattern against the human-in-the-loop approval mechanism.

Prerequisites:

  1. Ability to trigger system.run requests (as an agent or user).
  2. Write access to a directory within the proposed cwd path.

Attack Steps:

  1. Setup: The attacker creates a directory structure /tmp/exploit/safe_target. They then create a symlink /tmp/exploit/link pointing to /tmp/exploit/safe_target.
  2. Request: The attacker requests system.run with the command ls -la and cwd set to /tmp/exploit/link.
  3. Deception: The administrator receives the approval request. They inspect /tmp/exploit/link and see it points to a safe, empty directory. They approve the request.
  4. The Switch: Immediately after the approval is sent (or during the delay before the agent picks it up), the attacker executes:
    rm /tmp/exploit/link
    ln -s /root /tmp/exploit/link
  5. Execution: The OpenClaw Node receives the approved command. It attempts to spawn the process in /tmp/exploit/link. The OS follows the new symlink, executing ls -la inside /root.

This technique allows the attacker to execute commands in any directory on the system, bypassing the administrator's intent to restrict the agent to a sandbox.

Impact Assessment

The impact of this vulnerability is High, as it completely negates the primary security control (human approval) for agentic actions.

Confidentiality: An attacker can execute read commands (e.g., cat, grep) in sensitive directories like /etc, /root, or source code repositories, exfiltrating secrets, keys, or configuration data.

Integrity: If the command allows file modification (e.g., touch, rm, sed), the attacker can corrupt system files, inject backdoors into startup scripts, or modify application code, provided the OpenClaw process has the necessary OS-level permissions.

Availability: An attacker could execute destructive commands in critical system directories, leading to denial of service.

While the attacker is limited by the permissions of the user running the OpenClaw Node, in many deployment scenarios, agents run with significant privileges to perform their automation tasks. The vulnerability bypasses the logical authorization layer, elevating the risk to the full extent of the process's OS capabilities.

Remediation and Mitigation

The primary remediation is to upgrade the OpenClaw package to version 2026.2.26 or later. This version enforces immutable approval plans and validates the immutability of symlinks in the path.

Immediate Actions:

  • Upgrade: Run npm update openclaw or yarn upgrade openclaw to pull the latest patched version.
  • Audit: Review logs for system.run executions that involved paths in temporary directories (e.g., /tmp, /var/tmp) where symlink races are most common.

Defense in Depth:

  • Restrict Permissions: Ensure the OpenClaw Node runs with the least privilege necessary. Do not run agents as root.
  • Filesystem Hardening: Mount sensitive directories as read-only for the agent process where possible.
  • Avoid Temp Dirs: Configure agents to use dedicated, restricted working directories rather than shared, world-writable locations like /tmp for execution contexts.

Official Patches

OpenClawCommit: Harden node exec approvals
OpenClawCommit: Decompose nodes run approval flow

Fix Analysis (2)

Technical Appendix

CVSS Score
High/ 10

Affected Systems

OpenClaw

Affected Versions Detail

Product
Affected Versions
Fixed Version
OpenClaw
OpenClaw
< 2026.2.262026.2.26
AttributeDetail
CWE IDCWE-367 (TOCTOU)
Attack VectorLocal / Context-Dependent
SeverityHigh
CVSS ScoreHigh (N/A)
Exploit StatusConceptual PoC
Patch Date2026-02-26

MITRE ATT&CK Mapping

T1059Command and Scripting Interpreter
Execution
T1548Abuse Elevation Control Mechanism
Privilege Escalation
T1222File and Directory Permissions Modification
Defense Evasion
CWE-367
Time-of-check Time-of-use (TOCTOU) Race Condition

Vulnerability Timeline

Vulnerability Reported by @tdjackey
2026-02-26
Fix Commits Pushed
2026-02-26
OpenClaw v2026.2.26 Released
2026-02-26
GHSA Advisory Published
2026-02-26

References & Sources

  • [1]GitHub Advisory GHSA-F7WW-2725-QVW2
  • [2]OpenClaw Changelog

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.