T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:47
- Finding
- Shell Command Injection Through a User-Supplied Media URL## Vulnerability Details **File Location**: `SKILL.md`, lines 47-50 **Vulnerability Type**: Shell command injection caused by unsafe interpolation of user input **Risk Level**: High ### Vulnerable Code ```bash curl -s -X POST "https://www.grabgrab.fun/api/download" \ -H "Content-Type: application/json" \ -d '{"url": "<VIDEO_URL>", "videoQuality": "<QUALITY>"}' ``` ### Technical Analysis The Skill instructs the Agent to substitute a user-provided media URL directly into a Bash command. The URL is embedded inside a single-quoted shell argument without requiring shell-safe encoding. If the supplied URL contains a single quote, it can terminate the quoted JSON argument. The remaining input can then introduce shell operators and commands. JSON validity does not prevent this issue because Bash parses the command before `curl` or the remote API processes the JSON. The same pattern applies to the quality placeholder if it can be influenced by untrusted input. The Skill does not require an allowlist, strict parsing, or argument-safe process execution. ### Attack Path 1. An attacker supplies a purported media URL containing a single quote followed by shell syntax. 2. The Agent replaces `<VIDEO_URL>` in the documented command with the supplied value. 3. The injected quote terminates the original shell argument. 4. Bash interprets the remaining characters as shell operators or commands. 5. The injected command executes under the operating-system identity and permissions of the Agent process. ### Impact Assessment Successful exploitation can execute arbitrary shell commands with the Agent's current privileges. Depending on the runtime permissions, this may allow an attacker to read or alter accessible files, exfiltrate environment variables or credentials, download additional payloads, and modify project data. The issue does not independently grant elevated privileges, but it exposes the full authority ...[truncated 50 chars]
- Remediation
- ## Remediation Suggestions - Do not create a shell command by textually substituting the user-provided URL. - Invoke `curl` through a structured process API that passes each argument separately and does not invoke a shell. - Generate the request body with a real JSON serializer rather than embedding input in a JSON shell literal. - If Bash is unavoidable, pass values through environment variables or positional parameters and generate JSON with a tool such as `jq`: ```bash payload="$(jq -n --arg url "$VIDEO_URL" --arg quality "$QUALITY" \ '{url: $url, videoQuality: $quality}')" curl --fail --silent --show-error \ -X POST "https://www.grabgrab.fun/api/download" \ -H "Content-Type: application/json" \ --data-binary "$payload" ``` - Validate the URL with a URL parser and permit only expected `https` URLs from explicitly supported media platforms. - Validate quality and mode values against the documented fixed allowlists rather than accepting arbitrary strings. - Use `--fail`, bounded timeouts, and explicit response-size limits for safer network handling.
