T09 · Insecure Skill Coding Practices
- Location
SKILL.md:305- Finding
Shell Command Injection Through Unsanitized Cron Parameters
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:305-325
Vulnerability Type: Shell command injection
Risk Level: HighVulnerable Code
bash openclaw cron add \ --name "hitch-reserve:$(date +%s)" \ --at "TIME_VALUE" \ --session isolated \ --message "[Automatically book a ride from ORIGIN to DESTINATION and create a follow-up task]" \ --announce \ --channel CHANNEL_NAME \ --to "CHAT_ID"A second template uses the same unsafe construction:
bash openclaw cron add \ --name "hitch-status:ORDER_GUID" \ --at "5m" \ --session isolated \ --message "[Query the latest state of order ORDER_GUID]" \ --announce \ --channel CHANNEL_NAME \ --to "CHAT_ID"The message text above is an English rendering of the source text; the command structure and dynamic placeholders are unchanged.
Technical Analysis
The templates construct shell commands using values derived from ride addresses, order identifiers, and conversation metadata. The instructions do not require validation or shell-safe encoding before substituting
ORIGIN,DESTINATION,ORDER_GUID,CHANNEL_NAME, orCHAT_ID.CHANNEL_NAMEis especially dangerous because it is not quoted. AlthoughCHAT_IDand the message are enclosed in double quotes, double quotes do not prevent shell command substitution such as$(command)or backtick substitution. A malicious value could therefore alter command arguments or cause the shell to execute a nested command.The vulnerability applies when an Agent implements the documented template through textual substitution and passes the result to a shell.
Attack Path
- An attacker supplies a crafted address or influences a session metadata value.
- The value contains shell syntax, such as command substitution or argument-breaking metacharacters.
- The Agent substitutes the value into the documented cron command.
- The resulting string is ...[truncated 675 chars]
- Remediation
View remediation
Remediation Suggestions
- Do not construct commands through string interpolation or invoke them through a shell.
- Launch
openclawwith a structured process API that accepts an executable and an argument array. - Pass the task message, channel, destination, and schedule as separate arguments.
- Apply strict allowlists to
CHANNEL_NAMEand validate identifiers against documented formats. - Reject control characters, shell metacharacters, command-substitution syntax, and unexpected line breaks.
- If shell execution is unavoidable, apply a proven shell-escaping routine independently to every dynamic value.
- Prefer a native cron-management tool or MCP API over documented shell templates.
- Run scheduling operations under a minimally privileged account with restricted filesystem and network access.
