T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/generate_image.py:11
- Finding
- Hardcoded Cloudflare API Credentials<![CDATA[ ## Vulnerability Details **File Location**: `scripts/generate_image.py`, lines 11-13; the same credentials are also disclosed in `SKILL.md`, lines 9-12 **Vulnerability Type**: Hardcoded secret and plaintext credential exposure **Risk Level**: High ### Vulnerable Code ```python ACCOUNT_ID = "1e89d3ce76cbfef3b5c340e3984b7a52" TOKEN = "aCTA2KaKa1n3ayFDL-LPmZ-JgUC0HHgA5Msy18Bk" MODEL = "@cf/black-forest-labs/flux-1-schnell" ``` The same credential is documented in plaintext: ```markdown ## Credentials - Account ID: `1e89d3ce76cbfef3b5c340e3984b7a52` - Token: `aCTA2KaKa1n3ayFDL-LPmZ-JgUC0HHgA5Msy18Bk` - Model: `@cf/black-forest-labs/flux-1-schnell` ``` ### Technical Analysis A live-looking Cloudflare bearer token and its associated account identifier are embedded directly in the source code and documentation. Anyone who can download, inspect, clone, or otherwise access the Skill package can recover the credential without executing the Skill. Hardcoded secrets cannot be independently protected or rotated without changing the distributed package. They may also remain recoverable from repository history, archives, caches, logs, and previously distributed copies after being removed from the current files. ### Attack Path 1. An attacker obtains or inspects the Skill package. 2. The attacker reads `scripts/generate_image.py` or `SKILL.md`. 3. The attacker extracts the account ID and bearer token. 4. The attacker submits requests directly to Cloudflare using the stolen token. 5. The attacker exercises every permission granted to the token until it is revoked or expires. ### Impact Assessment Successful exploitation allows unauthorized access within the permissions assigned to the exposed token. The likely effects include unauthorized Workers AI requests, quota consumption, service disruption through resource exhaustion, and billing abuse. If the token has broader Cloudflare permissions than required for image generation, resources under the associated ...[truncated 181 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Revoke and rotate the exposed token immediately; treating it as compromised is necessary because it has already been distributed in plaintext. 2. Remove the token from both source code and documentation, including repository history and published artifacts where feasible. 3. Retrieve the token at runtime from a protected environment variable or secret-management service. 4. Fail safely with a clear error if the credential is unavailable; do not provide a default secret. 5. Create a replacement token restricted to only the Cloudflare account, API operation, and resources required for image generation. 6. Apply short expiration periods and usage monitoring where supported. 7. Add secret scanning to development and release pipelines to prevent credentials from being committed again. 8. Review Cloudflare audit and usage records for unauthorized activity involving the disclosed token. ]]>
