T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:158
- Finding
- Hardcoded WeCom Application Credentials<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 158–164; duplicated at lines 235 and 275–280 **Vulnerability Type**: Hardcoded application secret **Risk Level**: Critical ### Evidence ```bash CORP_ID="wwd00a4d7e69fffdf1" SECRET="Jg7-sBKn1rhynH_NUgAf-C6dxmNrpUIxLz8qfQ109OQ" AGENT_ID=1000009 TOKEN=$(curl -s "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=$CORP_ID&corpsecret=$SECRET" | jq -r '.access_token') curl -s -X POST "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=$TOKEN" ``` The same secret is also published in the configuration table at line 235 and assigned to `SECRET` again at line 276. ### Technical Analysis A reusable WeCom application secret is embedded directly in the published Skill instructions. Any party that can read the package can copy the corporate ID and secret and attempt to obtain an access token from the official WeCom token endpoint. The secret is supplied through a URL query string. Depending on the execution environment, this can additionally expose it through shell history, process inspection, command telemetry, HTTP proxy records, or application logs. The resulting access token is likewise placed in message API URLs. The exact access available to an attacker depends on the permissions assigned to WeCom Agent ID `1000009`. The repository does not establish those permissions, so broader privileges must not be assumed; however, the instructions demonstrate user-information retrieval and application-message delivery. ### Attack Path 1. Obtain a copy of `SKILL.md`. 2. Extract the corporate ID and hardcoded application secret. 3. Submit them to the official WeCom access-token endpoint: `https://qyapi.weixin.qq.com/cgi-bin/gettoken`. 4. If the credential remains valid and the request satisfies applicable WeCom restrictions, receive an application access token. 5. Use the token with APIs authorized for Agent ID `1000009`. 6. Potentially query user details or send messages under the ent ...[truncated 749 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Revoke and rotate the exposed WeCom application secret immediately. 2. Review token issuance and API audit logs for unauthorized activity. 3. Remove all copies of the secret from `SKILL.md`, package history, release artifacts, caches, and examples. 4. Load credentials at runtime from an approved secret manager or protected environment variable. 5. Ensure secret values are never rendered in prompts, logs, error messages, or generated command examples. 6. Apply least privilege to Agent ID `1000009`, limiting API permissions and recipient scope to operational requirements. 7. Enforce WeCom IP allowlisting where practical and regularly rotate credentials. 8. Avoid placing credentials or access tokens in logged command-line URLs. Use a protected integration layer that redacts sensitive query parameters. 9. Add automated secret scanning to the publishing pipeline and block releases containing credential patterns. ]]>
