T09 · Insecure Skill Coding Practices
- Location
SKILL.md:60- Finding
Shell Command Injection Through Unvalidated Database Names and SQL Input
- Content
View full analysis
diagnose slow-queries ``` ```bash dbskiter --database=<数据库名> diagnose sql "SELECT * FROM users WHERE email = 'test@test.com'" ``` The same unsafe command-construction pattern is repeated in the automated workflows: ```text 步骤1:执行 dbskiter --database= diagnose performance-snapshot 步骤2:查看返回的bottlenecks,确定瓶颈类型 步骤3:如果是慢查询导致,执行 dbskiter --database= diagnose slow-queries 步骤4:根据诊断结果,执行 dbskiter --database= diagnose recommend-indexes ``` ```text 步骤1:执行 dbskiter --database= diagnose sql "" 步骤2:如果评分<70,执行 dbskiter --database= diagnose recommend-indexes 步骤3:给出优化后的SQL和建议 ``` ### Technical Analysis The Skill instructs the Agent to substitute a database name and user-provided SQL directly into command-line strings. It does not require validation, shell escaping, structured argument passing, or execution without a shell. The database-name placeholder is unquoted: ```bash --database= ``` Consequently, whitespace and shell control operators in an attacker-controlled database name can be interpreted by a shell rather than being passed as one `dbskiter` argument. The SQL placeholder is enclosed in double quotes: ```bash diagnose sql "" ``` Double quotes do not neutralize every form of shell evaluation. In common shells, command substitutions such as `$(command)` and backtick substitutions remain active inside double-quoted strings. An input containing a closing quote may also terminate the intended argument and introduce shell operators. The vulnerability is exploitable when an Agent follows these instructions by constructing a command string and executing it through a shell. The project does ...[truncated 2073 chars]- Remediation
View remediation
