T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:81
- Finding
- Home Assistant bearer token may be transmitted over plaintext HTTP or to an untrusted endpoint## Vulnerability Details **File Location**: `SKILL.md:72-82`, `SKILL.md:110-112`, `SKILL.md:225-228`, `test.sh:54-75` **Vulnerability Type**: Plaintext credential transmission and insufficient endpoint validation **Risk Level**: High ### Vulnerable Code `SKILL.md:81-82` configures a plaintext HTTP endpoint: ```bash openclaw config set 'skills."xiaomi-home-ha".env.HA_URL' "http://192.168.31.202:8123" openclaw config set 'skills."xiaomi-home-ha".env.HA_TOKEN' "eyJhbGc..." ``` `SKILL.md:110-112` sends the long-lived token to that configured endpoint: ```bash curl -sf "${HA_URL}/api/" \ -H "Authorization: Bearer ${HA_TOKEN}" ``` `SKILL.md:225-228` similarly sends the token during privileged service calls: ```bash curl -sf -X POST "${HA_URL}/api/services/${DOMAIN}/${SERVICE}" \ -H "Authorization: Bearer ${HA_TOKEN}" \ -H "Content-Type: application/json" \ -d "$(jq -n \ ``` `test.sh:54-75` accepts an unrestricted URL and attaches the bearer token to every helper request: ```bash : "${HA_URL:?'HA_URL is required. Export it before running.'}" : "${HA_TOKEN:?'HA_TOKEN is required. Export it before running.'}" pass "HA_URL set: ${HA_URL}" pass "HA_TOKEN set (${#HA_TOKEN} chars)" ha_get() { curl -sf "${HA_URL}$1" \ -H "Authorization: Bearer ${HA_TOKEN}" \ -H "Content-Type: application/json" } ha_post() { curl -sf -X POST "${HA_URL}$1" \ -H "Authorization: Bearer ${HA_TOKEN}" \ -H "Content-Type: application/json" \ -d "$2" } ha_status() { curl -s -o /dev/null -w "%{http_code}" "${HA_URL}$1" \ -H "Authorization: Bearer ${HA_TOKEN}" } ``` ### Technical Analysis The documented configuration explicitly uses an unencrypted `http://` URL while the requests include a reusable Home Assistant long-lived access token in the `Authorization` header. Plain HTTP does not provide confidentiality or server authentication. A network observer or active m ...[truncated 2056 chars]
- Remediation
- ## Remediation Suggestions 1. Require an `https://` Home Assistant URL for non-loopback connections and reject plaintext HTTP before sending the token. 2. Permit HTTP only for explicit loopback testing, such as `127.0.0.1` or `localhost`, and never as the primary production example. 3. Validate `HA_URL` using a strict URL parser. Allow only expected schemes, ports, and configured hostnames or IP addresses. 4. Preserve TLS certificate verification and do not recommend `curl -k` or `--insecure`. 5. Use a trusted certificate for local Home Assistant deployments, or place Home Assistant behind a properly configured TLS reverse proxy. 6. Use a dedicated Home Assistant account with the minimum practical permissions rather than an administrator's token. 7. Avoid asking users to disclose tokens in chat. Direct them to configure secrets through a protected local interface or environment file with restrictive permissions. 8. Add a preflight check to `test.sh` that terminates before any request if the endpoint is insecure or outside an explicit allowlist. 9. Rotate any token that may already have traversed an untrusted plaintext network.
