T09 · Insecure Skill Coding Practices
- Location
SKILL.md:44- Finding
Untrusted Room Name Interpolated into Shell Command Templates
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 44-51 and 60-63
Vulnerability Type: Command injection through unsafe command construction guidance
Risk Level: HighThe skill instructs the Agent to substitute a user-provided room name directly into shell command templates:
markdown | User Says | Command | |-----------|---------| | Turn on the <room-name> AC / open AC | `scripts/midea_ac.py <room-name> on` | | Turn off the <room-name> AC / close <room-name> AC | `scripts/midea_ac.py <room-name> off` | | Toggle the <room-name> AC | `scripts/midea_ac.py <room-name> toggle` | | Warmer / more warm | Check status first, then increase temperature by 2 - 10 degrees | | Cooler / less heat | Check status first, then decrease temperature by 2 - 10 degrees | | Full speed / maximum | if mode is heat: `scripts/midea_ac.py <room-name> --temperature 30 --fan_speed max`, if mode is cool: `scripts/midea_ac.py <room-name> --temperature 16 --fan_speed max` | | Minimum speed | `scripts/midea_ac.py <room-name> --fan_speed low` | | <room-name> AC status / what's the <room-name> status | `scripts/midea_ac.py <room-name> status` | ## Before Executing 1. Navigate to skill directory: `cd ~/.openclaw/skills/midea_ac` 3. Run with uv: `python scripts/midea_ac.py <room-name> <command>` 3. Report the result to the user after executionTechnical Analysis
The
<room-name>placeholder originates from natural-language user input. The instructions do not require validation against the configured device names, shell-safe quoting, or execution through a process API that accepts an argument array.If an Agent follows these instructions by constructing a command string and passing it to a shell, shell metacharacters in the room name may be interpreted as command syntax rather than as one inert argument. Although the Python script itself does not invoke a shell, the vulnerable boundary is the skill's Agent-facing execu ...[truncated 1195 chars]
- Remediation
View remediation
Remediation Suggestions
- Validate room names against an exact allowlist derived from
AC_IPS; currently, onlylivingroomandbedroomshould be accepted. - Reject unknown names before starting any process instead of inserting them into a command.
- Execute the script with an argument array, such as
["python", "scripts/midea_ac.py", validated_room, validated_command], with shell processing disabled. - Update
SKILL.mdto explicitly prohibit concatenating natural-language input into shell command strings. - Validate commands and option values against explicit allowlists before execution.
- Add a guard in
scripts/midea_ac.pythat reports an unknown device and exits before callingDiscover.discover_single. - Add tests containing spaces, quotes, command separators, substitutions, and redirection characters to confirm that malformed room names are rejected and never interpreted by a shell.
- Validate room names against an exact allowlist derived from
