T07 · Tool Hijacking and Spoofing
- Location
SKILL.md:54- Finding
Untrusted Relative PowerShell Script Execution
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 54-60
Vulnerability Type: Untrusted relative script resolution
Risk Level: HighVulnerable Code
powershell ### Step 2: Run cleanup script ```powershell .\cleanup.ps1 # Clean the sessions.json index; retain .jsonl files by default .\cleanup.ps1 -DryRun # Preview changes without modifying files .\cleanup.ps1 -KeepJsonl # Explicitly retain .jsonl history files .\cleanup.ps1 -CleanJsonl # Dangerous: delete .jsonl files and conversation historytext The project contains only `SKILL.md`; the referenced `cleanup.ps1` script is not included. ### Technical Analysis The Skill instructs the user or agent to execute `.\cleanup.ps1`, which PowerShell resolves relative to the current working directory. Because the project does not supply or authenticate this script, the command may execute an unrelated or attacker-controlled file with the expected name. There is no absolute Skill-owned path, signature verification, checksum validation, provenance check, or inspection requirement before execution. The `-DryRun` option does not mitigate this issue because it is merely an argument passed to the selected script; a malicious script can ignore it. This is classified as tool hijacking and spoofing because an attacker can provide a malicious script under the trusted `cleanup.ps1` name, causing a legitimate-looking invocation to execute attacker logic. ### Attack Path 1. An attacker gains the ability to place or replace `cleanup.ps1` in the directory from which the documented command will be run. 2. The victim invokes the Skill to resolve slow OpenClaw startup or session accumulation. 3. Following the instructions, the victim stops the OpenClaw gateway. 4. The victim or agent executes `.\cleanup.ps1`, optionally with one of the documented arguments. 5. PowerShell resolves the relative path to the attacker-controlled script. 6. The ...[truncated 954 chars]- Remediation
View remediation
Remediation Suggestions
- Include the reviewed
cleanup.ps1implementation in the Skill package rather than referring to an absent script. - Resolve the script from a fixed, absolute path beneath the trusted Skill installation directory. Do not depend on the caller's current working directory.
- Before execution, verify that the resolved path remains inside the expected Skill directory and is a regular file rather than a symbolic link or reparse-point redirection.
- Publish and validate a cryptographic checksum or trusted code signature for the script. Abort execution if validation fails.
- Display the resolved script path and require explicit confirmation before running it.
- Make dry-run mode the required first step, while recognizing that dry-run arguments are trustworthy only after script provenance has been verified.
- Back up
sessions.jsonatomically before modification and provide a documented restoration procedure. - Require separate, explicit confirmation for
.jsonldeletion and restrict deletion to canonicalized paths within the expected OpenClaw data directory. - Run the cleanup with the least-privileged account necessary and reject execution under an elevated administrator context unless elevation is demonstrably required.
- Include the reviewed
