T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:20
- Finding
- Long-Lived Home Assistant Bearer Token May Be Transmitted over Plaintext HTTP<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:20,39-40`; `README.md:41,76-79` **Vulnerability Type**: Plaintext transmission of a long-lived authentication credential **Risk Level**: Medium ### Vulnerable Code `SKILL.md:20`: ```markdown - `HA_URL` — Your Home Assistant URL (e.g., `http://10.0.0.10:8123`) ``` `SKILL.md:39-40`: ```bash curl -s "$HA_URL/api/states" -H "Authorization: Bearer $HA_TOKEN" \ | jq -r '.[].entity_id' | sort ``` `README.md:41`: ```bash export HA_URL=http://10.0.0.10:8123 ``` `README.md:76-79`: ```bash curl -s -X POST "$HA_URL/api/services/light/turn_on" \ -H "Authorization: Bearer $HA_TOKEN" \ -H "Content-Type: application/json" \ -d '{"entity_id": "light.office", "brightness_pct": 80}' ``` ### Technical Analysis The documentation recommends an HTTP Home Assistant URL while instructing the Agent to send a long-lived bearer token in the `Authorization` header. Plain HTTP does not provide transport encryption, integrity protection, or server authentication. An attacker with visibility or control over the network path could capture the bearer token through passive traffic inspection or obtain it through an active man-in-the-middle attack. Because bearer authentication requires only possession of the token, an intercepted token can be replayed without knowing any additional credential. The exposure is particularly significant because the documentation states that Home Assistant long-lived tokens do not expire automatically. The same token is used for state queries and service calls involving private household information and physical devices. ### Attack Path 1. A user follows the documented configuration and sets `HA_URL` to an `http://` endpoint. 2. The skill sends a request containing `Authorization: Bearer $HA_TOKEN`. 3. An attacker on the same wireless network, compromised router, proxy, or other network path observes or modifies the plaintext request. 4. The attacker extracts the bearer token from ...[truncated 1056 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace all recommended `http://` URLs with `https://` URLs. 2. State explicitly that bearer tokens must not be transmitted over plaintext HTTP. 3. Validate `HA_URL` before making requests and reject non-HTTPS schemes by default. 4. If development access over plaintext is unavoidable, restrict it to an explicit loopback-only mode and display a security warning. 5. Preserve normal TLS certificate verification; do not recommend `curl -k` or `--insecure`. 6. Document secure deployment options for local Home Assistant installations, such as a trusted reverse proxy, a locally trusted certificate authority, or a secure VPN. 7. Recommend creating a dedicated, least-privileged Home Assistant account or token for the skill. 8. Document token revocation and rotation procedures following suspected disclosure. ]]>
