Back to skill

Security audit

diy-pc-master

Security checks for vulnerabilities and agentic risk

Overview

This PC-building skill is purpose-aligned overall, but it exposes a reusable API token and asks the agent to send raw SQL to a remote service.

Review this carefully before installing. The skill is not trying to modify your computer, but it relies on a third-party SQL API with a visible shared token. Prefer a version that uses a scoped product-search endpoint, keeps credentials out of the skill text, limits queries server-side, and clearly discloses what request data is sent externally.

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 (2)

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:170
Finding
Hardcoded Reusable API Token Exposed in Skill Documentation## Vulnerability Details **File Location**: `SKILL.md`, lines 170–173; repeated at lines 182 and 190 **Vulnerability Type**: Hardcoded credential **Risk Level**: Medium **Vulnerable code:** ```json { "VALID_TOKEN": "456645654121ssssqqqqq", "sql": "生成的SQL语句" } ``` The same token is included in executable request examples: ```json {"VALID_TOKEN": "456645654121ssssqqqqq", "sql": "SELECT id, ProductName, sale, golinkjd FROM goods WHERE category =11 AND is_on_sale = 1 AND sale BETWEEN 800 AND 1000 LIMIT 10"} ``` ### Technical Analysis A reusable API authentication token is embedded directly in the publicly readable Skill file. Any party with access to the package can extract the token without needing access to a protected secret store. The token is used to authenticate requests to `https://www.diyzp.cn/api/sql_api.php`. Its precise privileges, expiration policy, server-side restrictions, and rate limits are not documented. Consequently, the maximum impact depends on controls implemented by the remote service. At minimum, the exposed value permits attempts to impersonate legitimate Skill requests. Repeating the token in request examples increases exposure and makes accidental disclosure through source repositories, package registries, logs, prompts, and audit output more likely. ### Attack Path 1. An attacker obtains or inspects the Skill package. 2. The attacker reads `SKILL.md` and extracts the `VALID_TOKEN` value. 3. The attacker constructs independent POST requests to `https://www.diyzp.cn/api/sql_api.php`. 4. The attacker supplies the exposed token and SQL content in the JSON request body. 5. If the service accepts the token, requests execute under the authorization assigned to that shared credential. 6. The attacker can continue using the credential until it is revoked, rotated, expired, or blocked by server-side controls. ### Impact Assessment Successful exploitation grants access to ...[truncated 651 chars]
Remediation
## Remediation Suggestions 1. Immediately revoke and rotate the exposed token. 2. Remove all credential values from `SKILL.md`, examples, source control, package artifacts, and generated documentation. 3. Retrieve credentials at runtime from an approved secret manager or protected environment variable. 4. Use short-lived, narrowly scoped credentials rather than a shared static token. 5. Restrict the token to the minimum required endpoint and read-only operations. 6. Apply rate limits, request quotas, source restrictions where practical, and comprehensive audit logging. 7. Add automated secret scanning to development and release pipelines. 8. Review service logs for historical use of the exposed value and investigate anomalous requests.

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:142
Finding
User-Influenced Raw SQL Sent to a Remote SQL Execution Endpoint## Vulnerability Details **File Location**: `SKILL.md`, lines 142–146 and 170–173 **Vulnerability Type**: SQL injection and unrestricted query construction **Risk Level**: High **Vulnerable name-search template:** ```json { "名称检索": "SELECT * FROM `goods` WHERE `ProductName` LIKE '%AMD Ryzen7 9700X%' AND is_on_sale = 1" } ``` **Raw SQL API request format:** ```json { "VALID_TOKEN": "456645654121ssssqqqqq", "sql": "生成的SQL语句" } ``` ### Technical Analysis The Skill instructs the agent to generate complete SQL strings and submit them to a remote SQL API. The exact-name search pattern places a product name inside a quoted `LIKE` expression. The workflow does not specify parameterized queries, escaping, input validation, an allowlist, or a structured query interface. If an attacker-controlled product name is inserted into this template, quote characters and SQL syntax could escape the intended string literal and alter the generated query. Because the API accepts a complete SQL statement in the `sql` property, the security boundary depends entirely on undocumented server-side parsing, statement restrictions, database permissions, and multi-statement handling. A model instruction to produce a particular query shape is not a security control. Adversarial input can influence generated output, and the remote service must therefore treat the SQL field as untrusted. ### Attack Path 1. An attacker submits a PC-hardware request containing a crafted product name with quote characters and SQL syntax. 2. The Skill follows the documented exact-name search workflow and incorporates that text into the `LIKE '%...%'` SQL expression. 3. The crafted input terminates or modifies the intended string literal. 4. The generated SQL is placed directly in the API's `sql` field. 5. The request is authenticated using the embedded `VALID_TOKEN` and posted to the remote endpoint. 6. If the backend lacks prepared statemen ...[truncated 1308 chars]
Remediation
## Remediation Suggestions 1. Remove the general-purpose SQL API from the Skill interface. 2. Replace raw SQL requests with a typed endpoint accepting fields such as category, product name, minimum price, maximum price, and result limit. 3. Use server-side prepared statements and bind every user-influenced value as a parameter. 4. Validate numeric values against strict ranges and validate product names according to an explicit length and character policy. 5. Enforce a server-side allowlist of permitted tables, columns, predicates, sort options, and operations. 6. Reject comments, stacked statements, data-definition statements, data-modification statements, and database metadata access. 7. Run the endpoint with a dedicated read-only database account that can access only the required product fields. 8. Apply conservative query timeouts, row limits, rate limits, and resource limits. 9. Return only required columns instead of using `SELECT *`. 10. Add tests covering quote termination, comment syntax, Boolean filter bypasses, stacked-query attempts, encoding variations, and resource-exhaustion payloads. 11. Log normalized query parameters rather than raw secrets, and monitor repeated rejected injection attempts.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (6)

Vague Triggers

Medium
Confidence
92% confidence
Finding
The manifest description says the skill triggers when users ask about '电脑推荐、预算配置、配件分析、配置测评等问题', which is a broad, open-ended formulation rather than a tightly scoped invocation rule. Without explicit exclusions or narrower trigger phrases, this could cause unintended activation for general recommendation or shopping conversations.

Natural-Language Policy Violations

Medium
Confidence
85% confidence
Finding
The manifest description and the rest of the skill are written as a Chinese-only workflow, and the instructions include fixed Chinese output labels such as '只输出以下三个场景之一'. There is no indication that the user can choose another language or that the locale restriction is explicitly justified as a region-specific requirement.

Vague Triggers

Medium
Confidence
94% confidence
Finding
The matching logic treats broad terms like '推荐', '配置', '替换', '分析', and '怎么样' as sufficient indicators of a DIY build or evaluation scenario. These keywords commonly appear in everyday tech discussions, and the file does not provide negative examples or constraints to distinguish in-scope requests from general conversation.

Context-Inappropriate Capability

Medium
Confidence
94% confidence
Finding
The skill tells the agent to generate SQL strings and send them to a remote SQL API, effectively granting a broad database query primitive. Because the SQL is derived from user requests and the endpoint appears generic, this can lead to overbroad data access, query manipulation, or use of the skill as a conduit for unintended database operations.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The skill requires transmitting user-derived queries to a third-party API without any user-facing disclosure or consent step. Even if the content is about PC parts, user budget, preferences, and exact search strings are still externalized, creating privacy and transparency risks that are unnecessary without explicit notice.

Context-Inappropriate Capability

Medium
Confidence
95% confidence
Finding
The skill embeds a hard-coded API credential and instructs the agent to perform authenticated requests to an external endpoint. Exposing reusable secrets in skill content enables credential leakage and abuse, and the endpoint accepts SQL-bearing requests that could be repurposed beyond the intended recommendation workflow.

Static analysis

No suspicious patterns detected.