T09 · Insecure Skill Coding Practices
- Location
SKILL.md:19- Finding
Shell Command Injection Through Untrusted Playlist and Search Values
- Content
View full analysis
> /tmp/playlist_.json ``` ``` ```bash For each recommended song, search Bilibili for a playable link: ```bash python3 {baseDir}/scripts/search_bilibili.py " 官方MV" ``` ``` ### Technical Analysis The Skill instructs the Agent to construct shell commands by interpolating playlist IDs, artist names, and song names. The playlist identifier is not quoted or constrained to numeric characters. Consequently, shell metacharacters in that value can introduce additional commands, redirections, pipelines, or substitutions. The Bilibili search value is enclosed in double quotes, but double quotes do not disable shell command substitution. Values containing constructs such as `$(command)` or backticks can still cause commands to execute before Python receives the resulting argument. The Python scripts do not directly invoke a shell. The vulnerability exists in the documented invocation workflow: it becomes exploitable when an Agent follows the instructions using a shell-based execution tool and substitutes untrusted values into the command strings. ### Attack Path 1. An attacker provides a crafted playlist link or another input from which a malicious playlist identifier is extracted. Alternatively, attacker-influenced artist or song metadata reaches the Bilibili search step. 2. The malicious value contains shell syntax, such as a command separator for the unquoted playlist ID or command substitution syntax for the double-quoted search query. 3. The Agent substitutes the value into the command shown in `SKILL.md`. 4. The Agent executes the resulting string through a shell. 5. The shell interprets the injected syntax and executes the attacker-selected local command in additio ...[truncated 1041 chars]- Remediation
View remediation
