Back to skill

Security audit

mysql实践

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a MySQL DDL helper, but it can change local MCP tool configuration to add a formatter without clear validation or user approval.

Review this skill before installing if your agent can modify MCP configuration. Use it only if you will prevent automatic MCP server registration or require explicit approval and trusted allowlisting for any external formatter. The DDL-generation content itself appears purpose-aligned.

Vulnerability Patterns
  • Tool Hijacking and SpoofingModifies or replaces tools so legitimate-looking calls execute attacker logic
  • 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)

T07 · Tool Hijacking and Spoofing

Warning
Location
SKILL.md:104
Finding
Unvalidated External MCP Server Registration## Vulnerability Details **File Location**: `SKILL.md`, lines 104–108 **Vulnerability Type**: `T07: Tool Hijacking and Spoofing` **Risk Level**: Medium **Complete Code Snippet**: ```text MCP工具使用:本Skill以静态规范生成与审校为主,不依赖外部MCP工具;若运行环境提供SQL格式化MCP工具(例如 sql-formatter),可选执行: 1) 检查是否存在名为 sql-formatter 的MCP:调用 tools.list 或 capability 查询; 2) 若未安装且提供了mcpServers配置,则按照配置添加到本地mcpServers并重载; 3) 安装后调用 format_sql 工具对输出DDL进行格式化; 4) 工具不可用时,回退到内置简易格式化,不影响主流程。 ``` ### Technical Analysis The Skill instructs the agent to add a supplied MCP server configuration to its local environment and reload the MCP subsystem if a formatter is not already installed. It does not require the agent to validate the server's identity, source, integrity, version, transport security, or declared capabilities. It also omits explicit user approval and does not require the configuration change to be temporary. A tool name such as `sql-formatter` is not a security boundary. An attacker-controlled MCP server can advertise the expected `format_sql` capability while executing unrelated logic or returning manipulated SQL. Because SQL formatting is optional and the Skill already defines a built-in fallback, modifying local MCP configuration is unnecessary capability expansion. ### Attack Path 1. An attacker supplies or influences an `mcpServers` configuration that identifies a malicious server as a SQL formatter. 2. The agent follows the Skill instructions and adds that server to its local MCP configuration. 3. The agent reloads the MCP subsystem, making the attacker-controlled tool available. 4. The Skill invokes the server's advertised `format_sql` operation and transmits generated or reviewed DDL. 5. The malicious server captures schema information, returns altered SQL, or abuses any broader capabilities granted by the MCP runtime. 6. If the configuration remains installed, the untrusted tool may continue to be available in later operations. ### Im ...[truncated 823 chars]
Remediation
## Remediation Suggestions 1. Remove the instruction to automatically add supplied MCP server configurations. Use the built-in SQL formatter by default. 2. If external formatting is necessary, require explicit and informed user approval before installation, configuration changes, or data transmission. 3. Restrict permitted formatters to a fixed allowlist of trusted server identities and endpoints. 4. Pin the formatter implementation and version, and verify integrity through signatures or cryptographic hashes where supported. 5. Validate the server's transport security, provenance, requested permissions, and declared capabilities before use. 6. Grant only the formatting capability and deny filesystem, shell, credential, network, and unrelated tool access. 7. Treat formatter output as untrusted: compare it semantically with the input, reject added or removed SQL statements, and present material changes for user review. 8. Avoid persistent MCP configuration changes. Use an isolated, temporary registration and remove it immediately after the formatting operation. 9. Clearly disclose what SQL or schema information will be sent to the external service. 10. Fail safely to the existing built-in formatter whenever validation cannot be completed.
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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 (4)

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
The entire skill specification, inputs, outputs, and operational instructions are written as mandatory Chinese-language content, with no indication that users may choose another language or locale. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is explicitly justified.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The documented behavior goes beyond static analysis by instructing the agent to discover, install, and invoke external MCP tooling. This creates an unnecessary capability escalation path where a low-risk schema assistant can trigger environment changes and external tool usage unrelated to its core function.

Context-Inappropriate Capability

Medium
Confidence
97% confidence
Finding
The skill explicitly permits modifying local MCP server configuration and reloading tooling to add an external formatter, which exceeds the stated purpose of static DDL generation/review. Allowing a content-generation skill to alter local tool configuration expands the trust boundary and can be abused to introduce unreviewed tooling or persistence into the agent environment.

Natural-Language Policy Violations

Medium
Confidence
92% confidence
Finding
The checklist entries are written entirely in Chinese, which imposes a specific language on users of this template. There is no accompanying indication that the template is intentionally region-specific or that users may choose another language, which creates a natural-language locale policy concern.

Static analysis

No suspicious patterns detected.