T09 · Insecure Skill Coding Practices
- Location
references/boundaries.md:168- Finding
Arbitrary Command Execution Through Unsafe Path Expansion
- Content
View full analysis
- Remediation
View remediation
&2 return 1 } ``` ]]>
Security audit
Security checks for vulnerabilities and agentic risk
The skill tries to protect workspace file access, but its own boundary-check examples include unsafe path handling that could undermine that protection.
Install only if you are comfortable treating it as advisory guidance rather than a reliable enforcement layer. Before using its snippets, replace the eval path expansion, make path canonicalization fail closed, define one canonical workspace root, and move audit logging inside that root with structured escaping and retention limits.
references/boundaries.md:168Arbitrary Command Execution Through Unsafe Path Expansion
SKILL.md:72Workspace Boundary Bypass Through Fail-Open Canonicalization
references/boundaries.md:122Audit Log Injection and Boundary-Inconsistent Persistent Logging
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
fi
# Check for destructive commands
if echo "$cmd" | grep -qiE 'rm -rf|dd|:(){:|>|chmod 777'; then
echo "UNSAFE: Destructive operation"
return 1
fi
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
fi
# Check for destructive commands
if echo "$cmd" | grep -qiE 'rm -rf|dd|:(){:|>|chmod 777'; then
echo "UNSAFE: Destructive operation"
return 1
fi
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
### Common Dangerous Patterns
- `rm -rf /` - Catastrophic delete
- `:(){ :|:& };:` - Fork bomb
- `chmod 777 /` - Open all permissions
- `dd if=/dev/zero of=/dev/sda` - Disk wipe
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
### Common Dangerous Patterns
- `rm -rf /` - Catastrophic delete
- `:(){ :|:& };:` - Fork bomb
- `chmod 777 /` - Open all permissions
- `dd if=/dev/zero of=/dev/sda` - Disk wipe
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
- `:(){ :|:& };:` - Fork bomb
- `chmod 777 /` - Open all permissions
- `dd if=/dev/zero of=/dev/sda` - Disk wipe
- `> /etc/passwd` - Overwrite system files
## Audit Logging
The example eval "echo \"$path\"" | realpath performs shell evaluation on untrusted path input, which can trigger command substitution or other shell metacharacter expansion before boundary checks occur. In a workspace-guard skill whose purpose is to enforce path safety, documenting eval as a path-normalization technique is especially dangerous because consumers may copy it directly into enforcement logic.
The description says to use the skill before "ANY file operation" including common actions like read, write, and edit. For a markdown skill description, this activation language is very broad and does not provide clear exclusion conditions or narrower trigger phrases, which could cause unintended invocation during ordinary conversation about files.
The skill documents multiple workspace roots and aliases, but its enforcement examples and guard logic rely on a single hardcoded path. In a boundary-enforcement skill, contradictory rules can cause operators or downstream agents to believe a path is permitted when the implemented check would reject it, or vice versa if callers normalize differently, weakening a security control through ambiguity.
The stated allowed paths include aliases such as ~/openclaw/workspace and relative paths, but the sample case statement and guard_path function only allow one hardcoded absolute prefix. Because this skill is supposed to prevent unauthorized filesystem access, mismatched examples can lead integrators to deploy incomplete checks that fail open in wrappers or encourage unsafe manual exceptions when legitimate paths are blocked.
The document defines the workspace root as /home/iamlegend/.openclaw/workspace, but the logging example writes blocked-attempt records to /workspace/memory/audit.log. For a skill whose purpose is strict workspace-boundary enforcement, documenting writes to a different absolute root contradicts the declared boundary model and could place audit data outside the allowed workspace.
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.
## Operation Classification
### Safe (Auto-Approve Within Workspace)
- `read` - File reads
- `cat`, `less`, `head`, `tail` - View operations
- `ls`, `find`, `tree` - Listing
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
fi
# Check for destructive commands
if echo "$cmd" | grep -qiE 'rm -rf|dd|:(){:|>|chmod 777'; then
echo "UNSAFE: Destructive operation"
return 1
fi
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
fi
# Check for destructive commands
if echo "$cmd" | grep -qiE 'rm -rf|dd|:(){:|>|chmod 777'; then
echo "UNSAFE: Destructive operation"
return 1
fi
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
- `:(){ :|:& };:` - Fork bomb
- `chmod 777 /` - Open all permissions
- `dd if=/dev/zero of=/dev/sda` - Disk wipe
- `> /etc/passwd` - Overwrite system files
## Audit Logging
The documentation recommends environment-variable path expansion using eval without any warning, which normalizes an unsafe practice and can lead downstream implementations to execute attacker-controlled shell content. Even as an example, this undermines the skill's security model because boundary enforcement code is often reused verbatim.
No suspicious patterns detected.