T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/asl-api.sh:6
- Finding
- ASL API key transmitted over plaintext HTTP by the shell client<![CDATA[ ## Vulnerability Details **File Location**: `scripts/asl-api.sh:6-24` **Vulnerability Type**: Plaintext transmission of authentication credentials **Risk Level**: High ### Vulnerable Code ```bash ASL_PI_IP="${ASL_PI_IP:-100.116.156.98}" ASL_API_KEY="${ASL_API_KEY:-}" ASL_BASE="http://${ASL_PI_IP}:8073" _asl_call() { local method="$1" local endpoint="$2" local body="$3" if [ -z "$ASL_API_KEY" ]; then echo "ERROR: ASL_API_KEY not set. Source ~/.config/secrets/api-keys.env first." return 1 fi if [ -n "$body" ]; then curl -s -X "$method" -H "X-API-Key: $ASL_API_KEY" -H "Content-Type: application/json" -d "$body" "${ASL_BASE}${endpoint}" else curl -s -X "$method" -H "X-API-Key: $ASL_API_KEY" "${ASL_BASE}${endpoint}" fi } ``` ### Technical Analysis The shell client constructs its API endpoint with the plaintext `http://` scheme and sends the API key in the `X-API-Key` request header. HTTP provides neither server authentication nor transport encryption. Although the documentation recommends using a Tailscale address, the script does not verify that the destination is reached through Tailscale or another authenticated encrypted tunnel. It also contains a default private-network IP address. If `ASL_PI_IP` is omitted or incorrectly configured, the credential may be sent to an unintended host at that address. An attacker with a suitable network position could observe or modify the HTTP request. A malicious endpoint at the configured address could also directly collect the supplied API key. ### Attack Path 1. The user sets `ASL_API_KEY` and invokes the shell client. 2. The client constructs an endpoint such as `http://100.116.156.98:8073/`. 3. It places the API key in the plaintext `X-API-Key` header. 4. A network-positioned attacker observes the request, or an unintended host receives it. 5. The attacker extracts the key and submits authenticated requests to the reachable ASL Agent API. ...[truncated 691 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Require an HTTPS endpoint by default and configure the ASL Agent with a valid TLS certificate. 2. Remove the hard-coded IP fallback. Fail closed when neither `ASL_API_BASE` nor `ASL_PI_IP` is explicitly configured. 3. Reject `http://` endpoints unless the user provides a deliberate insecure-transport override. 4. If plaintext HTTP must be supported over Tailscale, verify and document that the address belongs to the expected tailnet and clearly warn that ordinary LAN or Internet HTTP is unsafe. 5. Keep TLS certificate verification enabled; do not introduce `curl -k` or `--insecure`. 6. Restrict the API key to the minimum backend permissions needed and rotate the key after any suspected exposure. 7. Consider pinning the expected server identity or certificate where operationally practical. ]]>
