T09 · Insecure Skill Coding Practices
- Location
SKILL.md:18- Finding
Potential Command Injection Through User-Controlled YouTube URL
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 18–22
Vulnerability Type: Shell command injection
Risk Level: MediumVulnerable code:
bash summarize "URL" --youtube web --video-mode transcript --extract --format mdtext When invoking it via `exec`, give it a long timeout and generous `yieldMs` so slow extraction is not killed early.Technical Analysis
The skill instructs the agent to place a user-provided YouTube URL into a command that may be invoked through
exec. It does not require URL validation, shell-free argument passing, or escaping appropriate to the execution environment.If an implementation replaces the
URLplaceholder through direct string interpolation and passes the resulting command to a shell, surrounding the value with double quotes is not a complete defense. An attacker may supply embedded quotation marks, command substitutions, or shell metacharacters that terminate or alter the intended argument. The shell could then interpret attacker-controlled content as additional commands.Exploitability depends on the agent's
execimplementation. An argument-array API that bypasses the shell would prevent shell metacharacter interpretation, while textual command construction followed by shell execution would expose the vulnerability.Attack Path
- An attacker submits a crafted value presented as a YouTube URL.
- The agent follows the skill instructions and substitutes that value into the documented
summarize "URL" ...command. - The agent invokes the constructed command through a shell-backed
execinterface. - The crafted value escapes or modifies the quoted argument using shell syntax.
- The shell executes attacker-supplied commands with the privileges of the agent process.
Impact Assessment
Successful exploitation could allow arbitrary command execution under the operating-system account running the agent. The attacker could pote ...[truncated 491 chars]
- Remediation
View remediation
Remediation Suggestions
- Invoke
summarizeusing a process API that accepts an executable and a separate argument array, without enabling a shell. For example, pass the URL as one argument rather than interpolating it into a command string. - Parse and normalize the supplied URL before execution.
- Permit only the
httpsscheme and explicitly approved YouTube hostnames, accounting for normalized hostname boundaries rather than substring matching. - Reject credentials in URLs, control characters, malformed encoding, unexpected quotation marks, and inputs that are not valid URLs.
- Document that agents must not use shell interpolation for the URL, even when it appears inside quotation marks.
- Apply least privilege to the execution environment, including restricted filesystem access, limited environment variables, network controls, and execution time and output limits.
- Add tests using malicious inputs containing embedded quotes, semicolons, command substitutions, newlines, and other shell metacharacters to verify that every value remains a single inert process argument.
- Invoke
