T09 · Insecure Skill Coding Practices
- Location
SKILL.md:58- Finding
Shell Command Injection Through Untrusted News Content
- Content
View full analysis
/tmp/stories.json python3 scripts/send_to_discord.py --webhook "..." --date "..." --topics "..." --stories-file /tmp/stories.json ``` ### Technical Analysis The skill instructs the agent to place web-derived headlines, summaries, and URLs directly inside single-quoted shell strings. These values are not guaranteed to be trusted because they originate from external news pages and search results. A single quote in any story value terminates the surrounding shell string. Shell metacharacters following that quote can consequently be interpreted as commands rather than data. The documented fallback is also unsafe: although it is recommended specifically when JSON contains single quotes, it still embeds the JSON inside a single-quoted `echo` command. This vulnerability occurs before `send_to_discord.py` parses the JSON, so JSON decoding and payload construction provide no protection against it. ### Attack Path 1. An attacker publishes or manipulates a searchable news article containing shell syntax in its headline or summary. 2. The agent selects that article while following the skill’s news-search instructions. 3. The malicious text is inserted into `STORIES_JSON_HERE`. 4. The agent executes the documented command through a shell. 5. An embedded single quote closes the intended argument, and the shell interprets the remaining attacker-controlled syntax. 6. The injected command executes with the same operating-system privileges as the agent process. For example, a story value shaped like the following could escape the quoted JSON context: ```t ...[truncated 556 chars]- Remediation
View remediation
