T07 · Tool Hijacking and Spoofing
- Location
scripts/export_session.py:21- Finding
Execution of an Unverified Mutable Workspace Tool
- Content
View full analysis
Vulnerability Details
File Location:
scripts/export_session.py, lines 21–22 and 55–63
Vulnerability Type: Unverified local tool execution
Risk Level: HighVulnerable Code
python WORKSPACE = os.path.expanduser("~/.openclaw/workspace") CHATPIPE = os.path.join(WORKSPACE, "products/chatpipe/chatpipe.py")python # Run chatpipe out_dir = WORKSPACE cmd = [ sys.executable, CHATPIPE, temp_path, "-o", output_format, "-d", out_dir, ] if title: cmd.extend(["--title", title]) result = subprocess.run(cmd, capture_output=True, text=True)Technical Analysis
The script executes
chatpipe.pyfrom a mutable location outside the audited Skill package. It only verifies that the path exists; it does not verify the file's ownership, permissions, trusted origin, version, or cryptographic integrity.Although the subprocess invocation uses an argument list and therefore does not directly introduce shell-command injection, Python will execute whatever code is present at the configured path. A local process or user capable of replacing or modifying
~/.openclaw/workspace/products/chatpipe/chatpipe.pycan cause attacker-controlled Python code to run under the identity invoking the Skill.The external process also receives the path to the temporary transcript file, giving a substituted tool direct access to the conversation being exported.
Attack Path
- An attacker obtains write access to
~/.openclaw/workspace/products/chatpipe/chatpipe.pyor one of its writable parent directories. - The attacker replaces the expected ChatPipe implementation with malicious Python code.
- A user or Agent invokes the session-export Skill.
- The script constructs a command using the unverified workspace path.
subprocess.run()launches the substituted script with the invoking user's privileges.- The malicious script can read the supplied transcript and access oth ...[truncated 671 chars]
- An attacker obtains write access to
- Remediation
View remediation
Remediation Suggestions
- Bundle the required ChatPipe implementation with the Skill so that the reviewed code is the code that executes.
- Alternatively, install a pinned and verified dependency through a controlled package-management process.
- Before execution, validate the target's canonical path, ownership, and permissions.
- Reject tools located in directories writable by untrusted users or processes.
- Verify the executable against a trusted cryptographic digest or signed manifest.
- Execute the converter with the minimum filesystem and process privileges required.
- Where practical, isolate conversion in a sandbox that only exposes the input file and designated output directory.
- Fail closed if any integrity or permission check fails.
