T07 · Tool Hijacking and Spoofing
- Location
SKILL.md:112- Finding
Ambiguous Script Discovery Can Execute an Attacker-Controlled Local Tool
- Content
View full analysis
/dev/null | head -1) # Fallback: check workspace skills [ -z "$MY_SCRIPT" ] && MY_SCRIPT=$(find ./skills -name "run" -path "*/my-skill/scripts/*" -type f 2>/dev/null | head -1) if [ -z "$MY_SCRIPT" ]; then echo "ERROR: script not found. Is the skill installed?" exit 1 fi $MY_SCRIPT ``` ### Technical Analysis The procedure searches broad, potentially user-writable directory trees and executes the first file whose name and path match a pattern. It does not establish a trusted installation root, verify the selected file's owner or permissions, reject symbolic links, validate file integrity, or confirm that the result belongs to the intended Skill installation. The use of `head -1` makes executable selection dependent on filesystem traversal order. An attacker who can create files under a searched workspace or OpenClaw directory may introduce a matching `run` file and cause it to be selected instead of the legitimate script. The variable is also executed without quoting, making paths containing whitespace or shell metacharacters unreliable and potentially increasing command interpretation risks. ### Attack Path 1. An attacker obtains write access to a workspace Skill directory or another location under the searched OpenClaw tree. 2. The attacker creates an executable file named `run` under a path matching `*/my-skill/*/scripts/*` or `*/my-skill/scripts/*`. 3. A user reports a script-resolution problem, causing the Agent to follow this repair procedure. 4. The broad `find` command locates the attacker's file as its first result. 5. The Agent executes the selected path through `$MY_SCRIPT `. 6. The attacker's script runs with the operating-system privileges ...[truncated 493 chars]- Remediation
View remediation
` to prevent word splitting. - If multiple installations are found, stop and require the user to select the intended trusted installation rather than choosing one implicitly. ]]>
