T09 · Insecure Skill Coding Practices
- Location
SKILL.md:226- Finding
User-Controlled Search Keyword Allows Shell Command Injection
- Content
View full analysis
{YYYY-MM-DD}&sort=stars&order=desc&per_page=10" | \ python3 -c " import sys, json data = json.load(sys.stdin) for r in data.get('items', [])[:10]: stars = r['stargazers_count'] name = r['full_name'] desc = (r.get('description') or '')[:100] url = r['html_url'] created = r['created_at'][:10] print(f'{created} | {stars} stars | {name}') print(f' {desc}') print(f' {url}') print() " ``` ### Technical Analysis The skill instructs the agent to extract entity or platform names from the user's request and insert the resulting keyword into shell commands. The `{keyword}` placeholder appears inside a double-quoted shell argument without any required validation, URL encoding, or argument-safe parameter handling. Double quotes do not prevent shell command substitution. If an implementation directly replaces `{keyword}` with attacker-controlled input before running the documented command, constructs such as `$(command)` or backticks are evaluated by the shell. The command substitution executes before `curl` receives the resulting URL. The Hacker News command at lines 201-219 uses the same unsafe interpolation pattern and is vulnerable under the same execution model. ### Attack Path 1. An attacker submits an entity or platform name containing shell metacharacters, such as a command substitution expression. 2. The skill extracts that attacker-controlled value as the search keyword, as directed at lines 105 or 148. 3. The agent directly substitutes the value for `{keyword}` in the shell command. 4. The agent invokes the command through a shell. 5. The shell eval ...[truncated 1442 chars]- Remediation
View remediation
