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.
