T09 · Insecure Skill Coding Practices
Error
- Location
- handler.py:10
- Finding
- Hardcoded SkillPay API Credential Exposed in Source Code and Documentation<![CDATA[ ## Vulnerability Details **File Location**: `handler.py:10-14`; duplicate disclosure in `SKILL.md:18-21` **Vulnerability Type**: Hardcoded secret and plaintext credential exposure **Risk Level**: High ### Vulnerable Code ```python # SkillPay Configuration SKILLPAY_API_KEY = "sk_93c5ff38cc3e6112623d361fffcc5d1eb1b5844eac9c40043b57c0e08f91430e" PRICE_USDT = "0.001" SKILLPAY_API_URL = "https://skillpay.me/api/v1/billing" ``` The same credential is published in the documentation: ```markdown ## Integration - API Key: sk_93c5ff38cc3e6112623d361fffcc5d1eb1b5844eac9c40043b57c0e08f91430e - Price: 0.001 USDT per call ``` ### Technical Analysis A live-formatted SkillPay API key is embedded directly in the Python source and repeated in public-facing skill documentation. Secrets packaged with source code cannot be kept confidential because every recipient of the package can read and reuse them. The key is submitted both in the JSON body and in the `X-API-Key` header when issuing billing requests. If the billing service recognizes the credential, an attacker can impersonate the skill and invoke any endpoint authorized for that key. ### Attack Path 1. An attacker downloads or otherwise obtains the skill package. 2. The attacker reads `handler.py` or `SKILL.md` and extracts the API key. 3. The attacker constructs requests to the SkillPay API using the stolen key in the expected header or request body. 4. The attacker performs any billing operations permitted by the credential until the key is revoked or additional server-side controls block the requests. ### Impact Assessment Successful exploitation could permit unauthorized API calls, fraudulent or manipulated billing operations, consumption of the account's service quota, and impersonation of the legitimate skill. The exact scope depends on the server-side permissions assigned to the key. The credential must be considered compromised because it has been distributed in plaintext. ]]>
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Immediately revoke and rotate the exposed SkillPay credential. 2. Remove the credential from `handler.py`, `SKILL.md`, package archives, and version-control history. 3. Retrieve the key at runtime from a secret manager or a protected environment variable. 4. Abort startup when the required secret is absent rather than falling back to a bundled value. 5. Assign the replacement key only the minimum billing permissions required by this skill. 6. Apply server-side rate limits, endpoint restrictions, transaction limits, and monitoring. 7. Review SkillPay logs for unauthorized use of the disclosed credential. 8. Add secret-scanning checks to development and release pipelines to prevent recurrence. ]]>
