T09 · Insecure Skill Coding Practices
- Location
payment.py:11- Finding
Hardcoded Billing API Credential
- Content
View full analysis
Vulnerability Details
File Location:
payment.py, lines 11–18
Vulnerability Type: Hardcoded API credential
Risk Level: HighVulnerable Code
python BILLING_API_URL = "https://skillpay.me" BILLING_API_KEY = "sk_f03aa8f8bbcf79f7aa11c112d904780f22e62add1464e3c41a79600a451eb1d2" SKILL_ID = "ac50f691-5081-4843-9942-bb3955872b23" SKILL_NAME = "whale-alert-monitor" PRICE_PER_CALL = 0.01 # USDT HEADERS = { "X-API-Key": BILLING_API_KEY, "Content-Type": "application/json" }Technical Analysis
A live-format billing API key is embedded directly in distributable source code and placed in the
X-API-Keyheader used by the balance, charge, and payment-link requests. Any party with access to the package can recover the credential without authentication or reverse engineering.This implementation also conflicts with
_meta.json, which declaresSKILLPAY_API_KEYas the intended environment variable. Hardcoding the key prevents secure per-deployment secret management and makes revocation or rotation difficult.The billing API’s server-side authorization policy was not available for review. Exploitability and maximum impact therefore depend on the permissions assigned to this key, but exposing an authentication credential is independently a confirmed security defect.
Attack Path
- An attacker downloads or otherwise obtains the Skill package.
- The attacker opens
payment.pyand extractsBILLING_API_KEY. - The attacker reconstructs authenticated requests using the disclosed base URL, header name, and endpoints present in the same file.
- The attacker sends requests to the balance, charge, or payment-link endpoints while presenting the exposed key.
- If the billing service accepts the key, the attacker performs any billing operations authorized to that credential until it is revoked, rotated, or restricted by the provider.
Impact Assessment
The attacker can obtain the billing integration’s API identity and potentia ...[truncated 497 chars]
- Remediation
View remediation
Remediation Suggestions
- Revoke and rotate the exposed API key immediately; assume it has already been compromised.
- Remove the credential from the source code and repository history.
- Read the key from the declared environment variable and fail closed when it is absent:
python BILLING_API_KEY = os.environ.get("SKILLPAY_API_KEY") if not BILLING_API_KEY: raise RuntimeError("SKILLPAY_API_KEY is required") HEADERS = { "X-API-Key": BILLING_API_KEY, "Content-Type": "application/json", }- Provision separate credentials per deployment instead of sharing one package-wide secret.
- Restrict the credential to the minimum required endpoints, Skill ID, transaction amount, and rate limits.
- Add server-side authorization checks so callers cannot select arbitrary users, Skill IDs, or charge amounts.
- Store production credentials in a dedicated secret manager or protected runtime environment.
- Add automated secret scanning to CI and pre-commit workflows.
- Review billing-provider logs for suspicious activity involving the exposed key and invalidate affected sessions or transactions.
- Require explicit user consent before initiating a charge and avoid the
"anonymous_user"fallback for billable operations.
