Back to skill

Security audit

数据库诊断与优化

Security checks for vulnerabilities and agentic risk

Overview

This database diagnostic skill is purpose-aligned, but needs review because it can trigger database inspections too broadly and gives unsafe command templates for database names and SQL.

Review this before installing in any environment with real database access. Use it only with explicit database targets, read-only credentials, and a runner that passes database names and SQL as structured arguments rather than interpolating them into a shell command.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Error
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
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (3)

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The activation guidance relies on loosely defined keywords without boundaries, making it easy for unrelated user requests to match and launch diagnostic actions. Because this skill interfaces with databases and can retrieve slow queries, locks, and performance data, ambiguous activation increases the risk of unintended access to sensitive operational information and unnecessary command execution.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The trigger phrase at this line is very broad (检查一下 / similar generic wording), so normal conversation can unintentionally activate the skill. In this context, accidental activation can cause the agent to run database diagnostic commands against a real environment, exposing operational metadata or performing unnecessary inspection without clear user intent.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

L003-L020 的 manifest 说明只声明了 slow-queries、sql、recommend-indexes、report、performance-snapshot 和 bottleneck 六类能力,没有包含 locks。但 L035 与 L083-L087 又明确指示在“有锁吗”场景下执行 diagnose locks,这说明同一技能文档对外宣称的能力范围与实际指导使用方式不一致。

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.