T09 · Insecure Skill Coding Practices
- Location
SKILL.md:10- Finding
Shell Command Injection Through User-Controlled Expense Arguments
- Content
View full analysis
--category --desc "" ``` ### Technical Analysis The skill instructs the agent to construct an `exec` command by directly interpolating expense data extracted from the user's message. The dynamic `amount` and `category` arguments are unquoted, while `desc` is only enclosed in double quotes. Double quotes do not prevent shell evaluation of command substitutions such as `$(command)` or backticks. A description containing an embedded quote may also terminate the intended argument and introduce additional shell syntax. Unquoted category or amount values provide further injection opportunities if the agent does not strictly validate them before constructing the command. The Python script's use of `argparse` does not mitigate this vulnerability because shell parsing and command substitution occur before Python receives the argument list. ### Attack Path 1. An attacker submits an expense-recording request containing a crafted field, for example a description equivalent to `$(touch /tmp/expense-skill-pwned)`. 2. The agent extracts the crafted text as the expense description. 3. Following `SKILL.md`, the agent interpolates it into the documented shell command: ```sh python3 /home/hoang/.openclaw/workspace/expense-tracker/scripts/finance_manager.py log --amount 50000 --category Food --desc "$(touch /tmp/expense-skill-pwned)" ``` 4. If `exec` invokes a shell, the shell evaluates the command substitution before launching `finance_manager.py`. 5. The injected command executes with the operating-system pri ...[truncated 1009 chars]- Remediation
View remediation
