Mar 3, 2026·5 min read·4 visits
Unsafe TAR/ZIP extraction in OpenClaw allows arbitrary file overwrite via directory traversal. Fixed in version 2026.2.14.
OpenClaw versions prior to 2026.2.14 contain a critical path traversal vulnerability, commonly known as 'Zip Slip', within the archive extraction and browser tool file handling components. This flaw allows remote attackers to write arbitrary files to the host filesystem by providing malicious archives or filenames containing directory traversal sequences. Successful exploitation can lead to Remote Code Execution (RCE) by overwriting sensitive configuration files or executables.
OpenClaw, an open-source automation tool, utilizes archive extraction for managing "skills" (plugins) and handling browser-based file downloads. A vulnerability exists in the src/infra/archive.ts and src/agents/skills-install.ts components where the application fails to validate the destination path of extracted files.
This flaw is a classic instance of "Zip Slip" (CWE-22). When the application processes a compressed archive (ZIP or TAR), it extracts entries based on the filenames specified within the archive headers. If an attacker crafts an archive containing files with directory traversal sequences in their names (e.g., ../../../../root/.ssh/authorized_keys), OpenClaw blindly follows these paths during extraction.
The vulnerability extends to the browser tool's file handling, where the suggestedFilename from remote servers was not sanitized, allowing malicious websites to trigger downloads that write to arbitrary system locations relative to the OpenClaw execution context.
The root cause of this vulnerability is the absence of canonical path validation during file extraction and creation. The application relied on high-level extraction commands (tar.x, unzip) or naive file writing logic without verifying that the resolved destination path resided within the intended directory.
In a secure implementation, an extraction routine must:
OpenClaw skipped this verification step. Specifically, in src/agents/skills-install.ts, downloaded skill archives were extracted directly. Consequently, the filesystem API accepted relative paths in filenames, processing them relative to the current working directory or the extraction root, allowing escape from the intended sandbox.
The vulnerability was addressed in commit 3aa94afcfd12104c683c9cad81faf434d0dadf87 by introducing strict path confinement checks. The developers implemented a new validation layer that inspects every file entry before it is written to the disk.
The fix introduces validateArchiveEntryPath and resolveCheckedOutPath. These functions enforce that all filesystem operations are confined to a safe directory.
Conceptual Patch Logic:
// VULNERABLE LOGIC (Conceptual)
// Archives were extracted without checking entry paths
function extract(archivePath, targetDir) {
// Implicitly trusts that archive entries are safe
exec(`tar -xf ${archivePath} -C ${targetDir}`);
}
// PATCHED LOGIC (Conceptual)
function extractSecurely(archivePath, targetDir) {
const resolvedTarget = path.resolve(targetDir);
// Iterate entries and validate before extraction
for (const entry of archiveEntries) {
const destination = path.resolve(targetDir, entry.path);
// CRITICAL FIX: Ensure the destination is inside the target
if (!destination.startsWith(resolvedTarget)) {
throw new Error("Zip Slip detected: Path traversal attempt");
}
// Additional hardening: Reject symlinks to prevent logical traversal
if (entry.isSymlink()) {
throw new Error("Symlinks not allowed in untrusted archives");
}
}
}The patch also includes preflight scanning for TAR archives (using tar tf) to list and validate entries prior to invoking the extraction command, ensuring that the tar binary does not process malicious paths.
Exploitation requires an attacker to induce the OpenClaw instance to process a malicious file. This can be achieved through two primary vectors:
suggestedFilename (e.g., ../../target).Attack Scenario:
../../../../home/node/.bashrc with a malicious payload (e.g., a reverse shell command).installSkill function.tar. The tar utility respects the relative path in the filename.~/.bashrc. The next time the user logs in or opens a shell, the payload executes.The impact of this vulnerability is rated High (CVSS 8.8). The ability to write arbitrary files to the host filesystem effectively bridges the gap between limited application access and full system compromise.
index.js) allows for persistent backdoor insertion.Since OpenClaw is an automation tool often running with significant privileges (to install packages, manage browsers, etc.), the likelihood of successful privilege escalation to root or full user compromise is high.
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H| Product | Affected Versions | Fixed Version |
|---|---|---|
OpenClaw OpenClaw | < 2026.2.14 | 2026.2.14 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-22 |
| CWE Name | Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') |
| Attack Vector | Network |
| CVSS v3.1 | 8.8 (High) |
| Impact | Arbitrary File Write / RCE |
| Exploit Status | Proof of Concept Available |
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.