T09 · Insecure Skill Coding Practices
- Location
SKILL.md:48- Finding
Unsafe Shell and JSON Interpolation in Messaging Commands
- Content
View full analysis
"$TOPIC" --data "{\"action\":\"create\",\"thread_id\":\"$THREAD_ID\",\"subject\":\"Discussion Topic\"}" ``` ```bash pilotctl --json publish "thread_$THREAD_ID" --data "{\"action\":\"reply\",\"thread_id\":\"$THREAD_ID\",\"message\":\"Response text\"}" ``` The workflow repeats the same construction pattern with variables: ```bash pilotctl --json publish "$PEER" "$TOPIC" --data "{\"action\":\"create\",\"thread_id\":\"$THREAD_ID\",\"subject\":\"$SUBJECT\",\"message\":\"Let's plan the Q2 data processing pipeline.\"}" ``` ```bash pilotctl --json publish "$PEER" "$TOPIC" --data "{\"action\":\"reply\",\"thread_id\":\"$THREAD_ID\",\"message\":\"Great! Can you handle 100K records per hour?\"}" ``` ### Technical Analysis The documented commands construct JSON by embedding values directly into a double-quoted shell argument. They do not use a JSON serializer to escape quotation marks, backslashes, control characters, or other metacharacters. If an agent adapts these templates by inserting attacker-controlled subjects or message text directly into the generated shell command, crafted content can terminate the intended JSON or shell quoting context. Shell syntax introduced before command parsing, including command substitution such as `$(command)` or backticks, can then be evaluated locally. Even when shell execution is not achieved, embedded quotation marks or backslashes can corrupt the JSON payload or alter its structure. The literal examples are benign, but the unsafe pattern is intended for sending conversation content, which may originate from untrusted peers. The vulnerable boundary is therefore the conversion of message content into shell source rather than treating that content strictly ...[truncated 1335 chars]- Remediation
View remediation
