T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/upload_image.py:13
- Finding
- Hard-Coded Third-Party Upload Credential<![CDATA[ ## Vulnerability Details **File Location**: `scripts/upload_image.py:13-14` **Vulnerability Type**: Hard-coded reusable API credential **Risk Level**: Medium ### Vulnerable Code ```python IMGURL_UID = os.environ.get("IMGURL_UID", "rrbhyq") IMGURL_TOKEN = os.environ.get("IMGURL_TOKEN", "sk-[REDACTED EXPOSED TOKEN]") ``` The token value has been redacted from this report but is stored in plaintext in the original source code. ### Technical Analysis The ImgURL UID and API token have hard-coded fallback values. When the corresponding environment variables are absent, every installation of the Skill silently uses the same embedded account credential. Supporting environment variables does not mitigate the issue because the committed fallback remains recoverable by anyone who can download or inspect the Skill. A reusable authentication secret must not be distributed in source code or package artifacts. ### Attack Path 1. An attacker obtains a copy of the publicly distributed or locally installed Skill. 2. The attacker opens `scripts/upload_image.py` and extracts the embedded UID and token. 3. The attacker sends requests directly to the ImgURL upload API using those credentials. 4. Requests are attributed to the shared ImgURL account rather than to the attacker. 5. The attacker can consume the account's upload allowance and exercise any other permissions granted to the exposed token. No local code execution or elevated operating-system privileges are required to exploit this issue. ### Impact Assessment The exposed credential can permit unauthorized use of the associated third-party account. Potential consequences include: - Upload quota or storage consumption. - Service abuse attributed to the credential owner. - Unexpected billing, if the account is connected to paid services. - Loss of accountability because all Skill users share one identity. - Possible exposure or manipulation of account resources if the token grants capabilities beyond uplo ...[truncated 174 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Revoke and rotate the exposed ImgURL token immediately. 2. Remove all hard-coded credential fallback values: ```python IMGURL_UID = os.environ.get("IMGURL_UID") IMGURL_TOKEN = os.environ.get("IMGURL_TOKEN") if not IMGURL_UID or not IMGURL_TOKEN: raise RuntimeError( "IMGURL_UID and IMGURL_TOKEN must be configured explicitly" ) ``` 3. Store credentials in a supported secret manager or protected runtime environment variables. 4. Issue separate credentials for each deployment or user instead of sharing one account identity. 5. Restrict the replacement token to the minimum API permissions and quota required for image upload. 6. Add automated secret scanning to source-control and release pipelines. 7. Review repository history and previously published packages because deleting the current value does not remove it from older artifacts. ]]>
