T09 · Insecure Skill Coding Practices
Error
- Location
- publish.py:10
- Finding
- Hard-Coded ClawHub Bearer Token Exposes Publishing Privileges<![CDATA[ ## Vulnerability Details **File Location**: `publish.py`, lines 10, 17-20, and 67-72 **Vulnerability Type**: Hard-coded authentication credential **Risk Level**: High ### Vulnerable Code ```python TOKEN = "clh_GKYQNYsiccGeacf6up29a0XJdyFdyPOCzzLWaWukx3k" API_URL = "https://clawhub.ai/api/v1/skills" ``` The token is then used by both supported network operations: ```python resp = requests.post( "https://clawhub.ai/api/cli/upload-url", headers={"Authorization": f"Bearer {TOKEN}"}, json={"filename": filename, "contentType": content_type} ) ``` ```python resp = requests.post( API_URL, headers={"Authorization": f"Bearer {TOKEN}"}, data={"payload": json.dumps(payload)}, files=file_data ) ``` ### Technical Analysis A bearer token is embedded directly in distributed source code. Bearer credentials do not provide proof of possession beyond knowledge of the token, so any party that can download or inspect the Skill can extract and replay it. The token is supplied to endpoints that create upload URLs and publish Skill packages. This authentication is required for the declared publishing functionality, but embedding a shared credential in the package exceeds safe least-privilege design. Each user should authenticate with an independently managed credential rather than inheriting the package author's identity and permissions. This also conflicts with `filter_tag.json`, which states that the Skill does not include authentication or an API key. The token's current validity and exact server-side permissions were not tested during this static audit, but it must be treated as compromised. ### Attack Path 1. An attacker downloads or otherwise obtains the Skill package. 2. The attacker opens `publish.py` and extracts the bearer token from line 10. 3. The attacker sends requests containing `Authorization: Bearer <token>` to the ClawHub upload or publishing APIs. 4. If the token remains valid, the API processes requests using the token ...[truncated 749 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Revoke the exposed token immediately and inspect its ClawHub activity for unauthorized use. 2. Generate a replacement credential with only the minimum permissions required to publish Skills. 3. Remove the token from source code and all repository history where feasible. 4. Obtain a user-specific token from a protected source, such as: - An environment variable; - An operating-system credential store; - A secret manager; - An interactive ClawHub authentication workflow. 5. Fail closed with a clear error when no credential is configured. 6. Avoid printing credentials or including them in exception messages and logs. 7. Add automated secret scanning to commits, CI workflows, and release packaging. 8. Rotate credentials regularly and support immediate revocation. 9. Correct the package metadata so it accurately declares its authentication and API-key requirements. ]]>
