T09 · Insecure Skill Coding Practices
- Location
SKILL.md:15- Finding
Command and SQL Injection Through Unvalidated Placeholder Substitution
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 15-17, 22-24, and 59-61
Vulnerability Type: Unvalidated input interpolation in shell and SQL commands
Risk Level: HighVulnerable Code
bash sqlite3 ~/Library/Application\ Support/Google/Chrome/Default/History \ "SELECT url, title FROM urls WHERE url LIKE '%TERM%' OR title LIKE '%TERM%' ORDER BY last_visit_time DESC LIMIT 10;"bash sqlite3 ~/Library/Application\ Support/Google/Chrome/Default/History \ "SELECT url, title FROM urls WHERE url LIKE '%youtube.com/watch%' AND (url LIKE '%TERM%' OR title LIKE '%TERM%') ORDER BY last_visit_time DESC LIMIT 10;"bash open -a "Google Chrome" "URL_HERE"Technical Analysis
The instructions encourage direct replacement of
TERMandURL_HEREinside shell command text. They do not require parameterized SQL, argument-safe command construction, input validation, or escaping.A search term containing SQL metacharacters can modify the intended query. More critically, because the SQL statement and URL are placed inside double-quoted shell arguments, shell substitutions such as command substitution may be evaluated if an agent constructs a command by inserting untrusted text into the documented template before execution.
Quoting a placeholder with double quotes is not a sufficient defense when untrusted content is incorporated into the shell command source itself. The resulting exposure depends on how the agent performs substitution, but the documented pattern makes unsafe execution likely.
Attack Path
- An attacker persuades the user or agent to search for a specially crafted term or open a crafted URL.
- The agent replaces
TERMorURL_HEREdirectly in the documented command template. - The shell parses metacharacters or command substitutions contained in the inserted value.
- The injected shell command executes with the privileges of the agent process, or inje ...[truncated 796 chars]
- Remediation
View remediation
Remediation Suggestions
- Replace command templates with a dedicated script that accepts search terms as data rather than shell source.
- Use SQLite bound parameters instead of concatenating search terms into SQL statements.
- Invoke processes through an argument-array API without
sh -c,bash -c, or equivalent shell evaluation. - Validate URLs with a proper parser and allow only explicitly supported schemes such as
httpsand, if necessary,http. - Reject control characters and unexpected schemes such as
file,javascript, and custom application handlers. - Require user confirmation before opening any URL obtained from history.
- Add adversarial tests covering quotes, SQL comments, semicolons, command substitutions, newlines, and shell metacharacters.
