T09 · Insecure Skill Coding Practices
Warning
- Location
- payment.py:15
- Finding
- Hard-Coded Payment API Credential Distributed with the Skill<![CDATA[ ## Vulnerability Details **File Location**: `payment.py:15-16`, `payment.py:31-33`; `_meta.json:9-15` **Vulnerability Type**: Hard-coded secret **Risk Level**: Medium ### Vulnerable Code ```python # payment.py:15-16 SKILLPAY_API_URL = "https://api.skillpay.io/v1" SKILLPAY_API_KEY = "sk_f03aa8f8bbcf79f7aa11c112d904780f22e62add1464e3c41a79600a451eb1d2" ``` ```python # payment.py:31-33 headers = { "Authorization": f"Bearer {SKILLPAY_API_KEY}", "Content-Type": "application/json" } ``` ```json // _meta.json:9-15 "pricing": { "enabled": true, "amount": "0.01", "currency": "USDT", "chain": "bsc", "apiKey": "sk_f03aa8f8bbcf79f7aa11c112d904780f22e62add1464e3c41a79600a451eb1d2" } ``` ### Technical Analysis A bearer credential for the SkillPay API is embedded in two files distributed with the Skill. Secrets stored in source code or package metadata cannot be treated as confidential because any user, registry operator, build system, or process with access to the package can extract them. The code uses this value directly as an HTTP `Authorization` bearer token. An attacker does not need to execute the Skill or bypass local controls to recover it. The credential's exact server-side permissions cannot be established from the repository, so the audit cannot confirm access beyond whatever privileges SkillPay assigned to this key. ### Attack Path 1. Download or otherwise obtain a copy of the Skill package. 2. Read `payment.py` or `_meta.json`. 3. Extract the embedded `sk_...` bearer credential. 4. Construct requests to the SkillPay API using `Authorization: Bearer <extracted-key>`. 5. Exercise any API operations permitted by that credential, potentially including payment-verification requests, until the key is revoked or rejected. ### Impact Assessment The exposed credential may allow unauthorized use of the associated SkillPay API identity. Potential impact includes API quota consumption, payment-verification probing, operational disrupt ...[truncated 359 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Immediately revoke and rotate the exposed API credential. 2. Remove the credential from both `payment.py` and `_meta.json`. 3. Purge the exposed value from repository history, release archives, caches, and published Skill packages where feasible. 4. Keep payment credentials in a protected server-side secret manager or environment provided by a trusted deployment platform. 5. Prefer a server-side payment-verification proxy so end-user Skill packages never receive the provider credential. 6. Scope the replacement credential to the minimum required verification endpoint and deny administrative or payment-modification operations. 7. Add automated secret scanning to pre-commit and CI pipelines. 8. Review API logs for use of the exposed key and configure rate limits and anomaly alerts. ]]>
