Summary
OpenClaw versions prior to 2026.2.14 contain a path traversal flaw in the TAR extraction logic that does not sanitize archive entry paths.
An attacker can craft a malicious TAR with sequences like ../../ to write files outside the intended extraction directory, which may lead to configuration tampering or lay the groundwork for arbitrary code execution depending on deployment context.
Affected context
This vulnerability affects environments where OpenClaw is responsible for extracting TAR archives, such as import pipelines, plugin/package upload features, or automated deployment tasks.
Risk is elevated when:
- TAR archives are accepted from untrusted or semi-trusted sources, and
- Extracted content is written to directories that influence application behavior (e.g., configuration folders, plugin directories, web roots, or scripts executed by scheduled tasks).
The issue manifests when the extraction process trusts paths embedded in the TAR entries without enforcing confinement to a designated base directory.
Exploit preconditions
- Attack surface: Any OpenClaw functionality that accepts and extracts TAR archives (API endpoints, CLI tools, background jobs).
- Required access: Ability to supply or influence a TAR file processed by OpenClaw (e.g., upload, sync, or import capability).
- Trigger point: Invocation of TAR extraction on the crafted archive, typically during an import, installation, or deployment workflow.
- Why exploitation is possible: The extraction logic fails to normalize and validate entry paths, allowing
..segments and absolute paths to escape the intended extraction directory and write to arbitrary locations accessible by the OpenClaw process.
Why this happens
The root cause is improper validation of file paths contained in TAR archive entries, mapping directly to CWE-22: Improper Limitation of a Pathname to a Restricted Directory.
The extraction code likely trusts the path names stored in the archive and concatenates them with a target directory without:
- Canonicalizing the resulting path, and
- Verifying that it remains under the designated extraction root.
This insecure pattern allows directory traversal sequences (../) or absolute paths to redirect writes to locations outside the intended directory tree, turning a simple extraction routine into a primitive for arbitrary file placement.
Potential impact
- Overwriting or creating configuration files that may alter application behavior.
- Planting or replacing scripts, libraries, or executable components that could be executed later (potential code execution).
- Modifying access control or security-related configuration (e.g., disabling authentication, weakening logging).
- Injecting web-accessible files (e.g., web shells) when OpenClaw writes into a web server document root.
- Corrupting application state by altering data files, indexes, or metadata.
- Facilitating lateral movement by writing SSH keys, service unit files, or cron jobs, depending on the privileges of the OpenClaw process.
General mitigation guidance
Effective mitigation centers on strictly confining archive extraction to a safe directory and distrusting paths embedded in the archive:
- Normalize and canonicalize each entry path before extraction and verify it remains within the intended base directory (e.g., compare real paths or use path traversal-safe utilities).
- Reject archive entries that contain
..segments, absolute paths, drive prefixes, or other constructs that can escape the target directory. - Enforce a strict allowlist of acceptable destination subpaths or patterns, rather than relying on the archive's structure.
- Run archive extraction under least-privilege accounts with minimal filesystem rights, so even if a path traversal occurs, the impact is constrained.
- Separate untrusted extraction areas from sensitive configuration, executable, and system directories, using dedicated, non-executable storage locations when possible.
How teams detect issues like this
Detection can combine code-centric and operational approaches:
- Static analysis: Look for TAR extraction logic that concatenates archive entry names with destination paths without canonicalization and boundary checks; flag use of low-level file APIs that write directly using archive-provided paths.
- Code review: Examine import and upload handlers for assumptions that archive contents are "trusted"; verify that extraction utilities enforce directory boundaries and reject suspicious paths.
- Runtime monitoring: Monitor for unexpected file creations or modifications outside designated extraction directories during TAR processing workflows, using filesystem auditing where feasible.
- Policy enforcement: Integrate secure-archive-handling rules into CI/CD pipelines, and use automated SAST tools or custom linters to block unsafe extraction patterns before deployment.

