Summary
OpenClaw versions prior to 2026.2.19 contain a path traversal vulnerability in the stageSandboxMedia function when iMessage remote attachment fetching is enabled.
An attacker who can tamper with attachment path metadata can supply arbitrary absolute filesystem paths and cause disclosure of files readable by the OpenClaw process on the configured remote host via SCP.
Affected context
This vulnerability arises in deployments of OpenClaw that:
- Enable iMessage remote attachment fetching
- Use the
stageSandboxMediafunction to retrieve and stage media from a remote host - Permit attachment path metadata to flow from an external or semi-trusted source into the SCP fetch logic
In these environments, the component may treat attachment metadata as trusted, allowing absolute paths to be used when copying files from the remote host's filesystem.
Exploit preconditions
- Attack surface: The interface or workflow that accepts or processes iMessage attachment metadata (e.g., messages, sync queues, or intermediary storage).
- Required access: Ability to influence or tamper with the attachment path metadata that OpenClaw later uses for remote fetching; this may be via compromised message sources, manipulated sync data, or man-in-the-middle positions depending on deployment.
- Trigger point: Invocation of
stageSandboxMediawhile iMessage remote attachment fetching is enabled and processing a crafted attachment record. - Why exploitation is possible: The function accepts arbitrary absolute paths without enforcing a safe base directory or normalizing and validating the requested path. As a result, the SCP operation may retrieve files outside the intended attachment directory scope, exposing any file readable to the OpenClaw account on the remote system.
Why this happens
The underlying issue is insufficient validation of file paths derived from untrusted or semi-trusted metadata before they are used in filesystem or remote-copy operations.
Instead of constraining attachment paths to a defined, expected directory tree or sanitizing input to prevent traversal outside that tree, the implementation allows arbitrary absolute paths to be passed directly into SCP.
This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where user-controlled input influences path resolution without appropriate canonicalization and enforcement of a restricted base directory.
Potential impact
- Disclosure of sensitive files located outside the intended attachment directory on the remote host
- Exposure of configuration files, logs, or private data accessible to the OpenClaw process
- Leakage of credentials, keys, or tokens stored in readable files on the remote system
- Increased likelihood of follow-on attacks, such as lateral movement or privilege escalation, using exposed information
General mitigation guidance
Effective mitigation focuses on constraining and sanitizing all file paths derived from attachment metadata before they are used in SCP or other file operations.
Recommended defensive patterns include:
- Enforcing a strict base directory for all remote attachment paths and rejecting any absolute or normalized path that resolves outside this directory.
- Canonicalizing paths (e.g., resolving
..segments and symlinks where feasible) and performing allowlist checks on the resulting canonical path. - Treating attachment metadata as untrusted input regardless of its perceived origin, and validating it against a schema that disallows absolute paths and traversal sequences.
- Implementing least-privilege for the OpenClaw account on the remote host so that even if path validation fails, the process cannot read highly sensitive files.
- Applying secure-by-default configuration, such as disabling remote attachment fetching in environments where it is not strictly required.
How teams detect issues like this
Organizations can detect and monitor for this class of vulnerability through a combination of code-centric and operational approaches:
- Static analysis and code review:
- Search for SCP or file-copy calls that accept user-influenced paths without normalization and base-directory checks.
- Flag uses of absolute paths derived from message or attachment metadata.
- Review boundary components that translate external metadata into filesystem paths, ensuring explicit validation logic is present.
- Security testing:
- Incorporate path traversal test cases into QA and security testing for any feature that fetches or stages remote attachments.
- Use dynamic analysis or fuzzing against the attachment ingestion workflow to surface unexpected file access.
- Operational monitoring:
- Log all remote file fetch paths used by OpenClaw and alert on unexpected directories (e.g.,
/etc, home directories, or key stores). - Monitor for anomalous SCP activity originating from the OpenClaw service account on the remote host.

