T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/run-docker.sh:5
- Finding
- Unencrypted Remote Docker Management Transport## Vulnerability Details **File Location**: `scripts/run-docker.sh:5-12, 95, 212, 291, 386-389, 582` **Vulnerability Type**: Plaintext transmission of sensitive Docker API traffic **Risk Level**: High ### Vulnerable Code ```bash # Resolve proxy URL if [[ -n "${DOCKER_PROXY_URL:-}" ]]; then BASE_URL="${DOCKER_PROXY_URL}" elif [[ -n "${DOCKER_HOST:-}" ]]; then BASE_URL="${DOCKER_HOST/tcp:\/\//http://}" else BASE_URL="http://localhost:2375" fi BASE_URL="${BASE_URL%/}" ``` The resulting URL is used directly for Docker management requests, including general API calls, events, logs, and command execution: ```bash response=$(curl "${args[@]}" "${BASE_URL}${path}" 2>&1) ``` ```bash curl -sf "${BASE_URL}/events?${qs}" | jq -r ' "\(.time | todate) \(.Type) \(.Action) \(.Actor.Attributes.name // .Actor.ID[:12])"' ``` ```bash curl -sf "${BASE_URL}/containers/${id}/logs?stdout=1&stderr=1&tail=${tail}" | strip_frames ``` ```bash curl -sf -X POST -H 'Content-Type: application/json' \ -d '{"Detach":false,"Tty":false}' \ "${BASE_URL}/exec/${exec_id}/start" | strip_frames ``` ```bash curl -sf "${BASE_URL}/services/${name}/logs?stdout=1&stderr=1&tail=${tail}" | strip_frames ``` ### Technical Analysis When `DOCKER_HOST` uses the conventional `tcp://` syntax, the script automatically converts it to `http://`. The default endpoint is also plaintext HTTP. The implementation does not enforce TLS for non-loopback hosts and does not provide explicit CA-certificate or mutual-TLS configuration. Consequently, Docker API requests and responses may cross the network without confidentiality or integrity protection. Depending on the proxy permissions, this traffic can contain container environment variables, logs, infrastructure metadata, arbitrary commands submitted through the `exec` mode, and high-impact lifecycle or pruning requests. The Docker Socket Proxy limits API endpoints but does not itself make plaintext transport secure. Network-path attackers may still obs ...[truncated 1566 chars]
- Remediation
- ## Remediation Suggestions 1. Require `https://` for every non-loopback Docker proxy endpoint and reject remote `http://` URLs by default. 2. Do not automatically convert `tcp://` to `http://`. Require an explicit secure scheme or map remote TCP endpoints to HTTPS only under a documented policy. 3. Add explicit TLS settings for: - a trusted CA certificate; - a client certificate and private key when mutual TLS is used; - strict hostname verification. 4. Never use options that disable certificate verification. 5. If plaintext localhost support is necessary, permit it only for validated loopback addresses and Unix-local forwarding. 6. Place the proxy on an authenticated, isolated management network and restrict inbound access with firewall rules. 7. Keep Docker Socket Proxy endpoint permissions minimal, especially for `EXEC`, destructive lifecycle operations, and prune endpoints. 8. Update `README.md` and `SKILL.md` to warn against exposing port 2375 over untrusted networks and to provide a secure TLS deployment example. 9. Add startup validation that fails closed when a non-loopback endpoint lacks TLS.
