The vulnerability in OpenClaw's OpenShell Mirror Sync stems from improper handling of symbolic links and insufficient path validation during file synchronization between the host and a remote sandbox. This created a sandbox escape vector. The analysis of the patch commits reveals two primary attack surfaces:
-
Symlink Traversal on Download: The replaceDirectoryContents function, which is called by OpenShellSandboxBackendImpl.syncWorkspaceFromRemote, was used to mirror a remote sandbox directory to the local host. The original implementation did not correctly handle symbolic links within the sandbox. An attacker could create a symlink in the sandbox pointing to an arbitrary path on the host filesystem (e.g., ../../../../etc/passwd). When the sync operation occurred, the application would traverse this symlink and write content to the specified host path, leading to arbitrary file write outside the intended workspace.
-
Symlink Traversal on Upload: The OpenShellSandboxBackendImpl.uploadPathToRemote function was responsible for uploading local files to the sandbox. It directly uploaded the provided path. If a malicious actor could place a symbolic link within the directory being uploaded that pointed to a sensitive file on the host (e.g., ~/.ssh/id_rsa), the upload process would dereference the link and exfiltrate the sensitive file to the attacker's sandbox.
The initial fix (c02ee8a) attempted to mitigate part of the issue by preventing the hooks/ directory from being synced, which could lead to remote code execution. However, the core symlink traversal vulnerability remained. The complete fix (3b9dab) addresses the root cause by introducing a new copyTreeWithoutSymlinks utility that explicitly checks for and ignores symlinks during copy operations. This hardened function is now used by replaceDirectoryContents (for downloads) and a new stageDirectoryContents function (for uploads) to ensure that file operations are strictly confined within the workspace boundaries, preventing path traversal attacks in both directions.