T09 · Insecure Skill Coding Practices
- Location
tools/rpc.sh:57- Finding
MQTT Commands and Device Responses Use Plaintext, Unauthenticated Transport by Default
- Content
View full analysis
.vmflow.xyz is the device topic, not a host TS="$(date +%s)" # UTC epoch — fresh (device enforces a 10s window) MSG="$CMD:$ARGS:$TS" SIG="$(printf '%s' "$MSG" | openssl dgst -sha256 -hmac "$PASSKEY" -hex | awk '{print $NF}')" PAYLOAD="$MSG:$SIG" REPLY_TOPIC="domain.vmflow.xyz/$SUB/rpc/$CMD" if [ "$WAIT" -eq 1 ]; then # Subscribe to the reply first so we don't miss it, then publish. mosquitto_sub -h "$HOST" -t "$REPLY_TOPIC" -C 1 -W 15 "${EXTRA[@]}" & SUB_PID=$! sleep 0.3 fi echo "-> $HOST $SUB.vmflow.xyz/rpc '$PAYLOAD'" >&2 mosquitto_pub -h "$HOST" -t "$SUB.vmflow.xyz/rpc" -m "$PAYLOAD" -q 1 "${EXTRA[@]}" if [ "$WAIT" -eq 1 ]; then echo "<- waiting on $REPLY_TOPIC (15s)" >&2 wait "$SUB_PID" fi ``` The documented direct usage has the same insecure default: ```bash MQTT_HOST="${MQTT_HOST:-mqtt.vmflow.xyz}" TS=$(date +%s) SIG=$(printf '%s' "info:-:$TS" | openssl dgst -sha256 -hmac "$PASSKEY" -hex | awk '{print $NF}') # publish; listen for reply on domain.vmflow.xyz/$SUB/rpc/info mosquitto_pub -h "$MQTT_HOST" -t "$SUB.vmflow.xyz/rpc" -m "info:-:$TS:$SIG" -q 1 ``` ### Technical Analysis The default `mosquitto_pub` and `mosquitto_sub` invocations specify neither a TLS port nor CA verification. They also provide no broker authentication by default. Although the command envelope contains an HMAC, that HMAC only authenticates the signed command contents. It does not provide transport confidentiality, hide device identifiers, authenticate the MQTT broker, or protect reply messages. The reply subscription accepts the first message received on the predictable topic `domain.vmflow.xyz/$SUB/rpc/$CMD`. The code does ...[truncated 2376 chars]- Remediation
View remediation
