T09 · Insecure Skill Coding Practices
- Location
SKILL.md:28- Finding
Shell Command Injection Through User-Controlled OAuth Callback Input
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 28-32
Vulnerability Type: Command injection through unsafe shell interpolation
Risk Level: HighVulnerable Code
markdown 2. If user input contains callback URL/code: - Run: ```bash cs relogin "<callback-url-or-code>" ```Technical Analysis
The skill instructs the agent to place a callback URL or authorization code supplied by the user directly into a Bash command. Quoting the value with double quotes does not reliably prevent shell injection. Bash continues to evaluate command substitutions such as
$()and backticks inside double-quoted strings.If the agent constructs the documented command as shell text without structured argument passing or shell-safe encoding, a crafted callback value can cause an additional command to execute before
cs reloginreceives its argument. The skill does not require callback format validation, character allowlisting, shell escaping, or use of a process API that accepts an argument array.Attack Path
- An attacker supplies a callback value containing shell syntax, such as a command substitution expression.
- The agent substitutes the value into the documented
cs relogin "..."command. - Bash evaluates the injected command substitution while processing the double-quoted argument.
- The injected command executes under the operating-system identity and permissions of the agent process.
- The resulting output is passed to
cs relogin, potentially obscuring the preceding unauthorized execution.
Impact Assessment
Successful exploitation can provide arbitrary command execution with the agent's local privileges. Depending on those privileges and the surrounding environment, an attacker could read accessible files and credentials, modify project or user files, execute local programs, make network requests, or interfere with authentication state. The issue does n ...[truncated 143 chars]
- Remediation
View remediation
Remediation Suggestions
- Do not construct a shell command by interpolating the callback value into command text.
- Invoke
csthrough a structured process-execution interface using a fixed argument array, equivalent to["cs", "relogin", callback], with shell processing disabled. - Validate callback input against the exact formats supported by
cs, including an allowlisted URL scheme, expected callback host and path, permitted query parameters, and documented authorization-code character set and length. - Reject control characters, unexpected URL schemes, malformed encoding, and input containing data outside the documented callback grammar.
- If a shell is unavoidable, use a well-tested shell-escaping routine and pass the value as a positional parameter rather than concatenating it into executable command text.
- Add security tests covering
$(), backticks, quotes, semicolons, newlines, redirection operators, and other shell metacharacters.
