T09 · Insecure Skill Coding Practices
- Location
downloader.sh:35- Finding
User-Controlled yt-dlp Option Injection Enables Arbitrary Command Execution
- Content
View full analysis
"$YTDLP_EXIT_FILE" ) 2>&1 | ``` ### Technical Analysis The `links` parameter is accepted as a space-separated string and split into individual shell array elements. Each resulting token is passed to `yt-dlp` as an argument without validating that it is an HTTP or HTTPS URL. Although `"$URL"` is shell-quoted, shell quoting does not prevent the invoked program from interpreting a value beginning with `-` as a command-line option. The script also does not place the standard `--` option terminator before the URL. Consequently, an attacker can provide `yt-dlp` options through the `links` parameter. This is particularly dangerous because `yt-dlp` supports execution-related options such as `--exec`. An injected execution option can cause commands to run under the operating-system identity and permissions assigned to the skill. ### Attack Path 1. An attacker supplies a crafted `links` value containing a token such as an injected `yt-dlp` execution option followed by a valid URL. 2. `read -ra LINKS` splits the string into separate arguments. 3. The injected token is assigned to `URL` during one loop iteration. 4. The script invokes `yt-dlp` without a `--` option terminator. 5. `yt-dlp` interprets the attacker-controlled token as an option instead o ...[truncated 888 chars]- Remediation
View remediation
