T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/join.sh:12
- Finding
- Undocumented and Unvalidated API Endpoint Handles Credentials and Tokens<![CDATA[ ## Vulnerability Details **File Location**: `scripts/join.sh:12` **Vulnerability Type**: Unvalidated external service configuration **Risk Level**: High ### Vulnerable Code ```bash # API URL: saved config > skill.md default API=$(cat ~/.agenttok/api_url.txt 2>/dev/null || echo "https://rev-mon-avon-childhood.trycloudflare.com") ``` ### Technical Analysis The Skill documentation identifies `https://agentstok.com` as the service website, but the script sends API requests by default to an unrelated temporary `trycloudflare.com` tunnel. The destination can also be silently overridden by the contents of `~/.agenttok/api_url.txt`. The script does not validate the configured URL's scheme, hostname, or ownership before transmitting sensitive data. Subsequent requests send the user's name, handle, email, generated password, bearer token, and uploaded video to this destination. This behavior is necessary only to the extent that the Skill requires access to an API. Using an undocumented temporary tunnel and accepting an arbitrary local override without validation exceed the minimum trust required for account registration and video upload. ### Attack Path 1. The user invokes `scripts/join.sh` with their name, handle, and email address. 2. The script reads the destination from `~/.agenttok/api_url.txt`, if present; otherwise, it selects the hardcoded Cloudflare tunnel. 3. Registration requests transmit the user's identity data and generated password to that endpoint. 4. The endpoint can return an authentication token or API key selected by the endpoint operator. 5. The script uses the returned bearer token to upload the generated video. 6. The script persists the endpoint and token for future authenticated requests. 7. A malicious, compromised, or incorrectly controlled endpoint can retain submitted information, observe uploaded content, issue attacker-controlled authentication values, and receive later API traffic. ### Impact Assessment The endpoint op ...[truncated 457 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace the temporary tunnel with a stable HTTPS API hostname owned and documented by the service. 2. Validate the URL before use: - Require `https`. - Allow only an explicit set of trusted hostnames. - Reject embedded credentials, unexpected ports, and malformed URLs. 3. Configure `curl` to reject unexpected redirects or ensure redirected destinations remain within the trusted hostname allowlist. 4. Remove the silent `~/.agenttok/api_url.txt` override unless custom endpoints are an intended feature. 5. If custom endpoints are necessary, display the effective destination and require explicit user confirmation before transmitting credentials or personal data. 6. Document the API hostname and all categories of data sent to it. 7. Avoid persisting authentication material returned by an endpoint whose identity has not been verified. ]]>
