T09 · Insecure Skill Coding Practices
- Location
SKILL.md:20- Finding
Shell Command Injection Through Unsafely Interpolated Search Terms
- Content
View full analysis
" --top 1 - Search for anime by AniList ID: python3 "{baseDir}/anilist_cli.py" anime --id - Search for a character: python3 "{baseDir}/anilist_cli.py" character --search "" --top 1 - Search for voice actors or staff: python3 "{baseDir}/anilist_cli.py" staff --search "" --top 1 ``` The original instructions use Chinese placeholder descriptions, but the command structure above faithfully represents the affected code. ### Technical Analysis The Skill instructs the Agent to construct shell command strings by placing user-supplied search terms inside double quotes. Double quotes do not neutralize all shell syntax. In common POSIX shells, command substitutions such as `$(command)` and backtick substitutions are still evaluated inside double-quoted strings. An input containing an embedded quote may also terminate the intended argument and introduce additional shell operators. The Python implementation uses `argparse` and does not directly invoke a shell, so the flaw does not originate in `anilist_cli.py`. The vulnerable boundary is the command-construction procedure prescribed by `SKILL.md`: the shell can interpret malicious syntax before Python receives the search argument. For example, if an Agent directly substitutes a search term containing `$(attacker_command)` into the documented command, the shell executes `attacker_command` and passes its output to the Python process as part of the argument. ### Attack Path 1. An attacker submits an anime, character, or staff search term containing shell syntax, such as a command substitution expression. 2. The A ...[truncated 1442 chars]- Remediation
View remediation
