Latest Results
Sanitize unauthenticated noise hello fields before logging
The noise hello phase exchanges server_name, mac_address, and a
handshake-failure explanation as raw bytes *before* the
PSK-authenticated handshake completes. The previous code interpolated
those attacker-controlled strings unescaped into log/error messages
and stored them on self for reuse by every later error path. An
on-path attacker (ARP spoof, compromised VLAN device) could inject
CRLF + ANSI escape sequences into operator-visible logs (HA UI,
syslog, webhooks) — forging fake log lines, hijacking terminals via
CSI sequences, and impersonating a different device's identity in
alert messages.
Add _safe_label() which decodes with errors='replace' and strips any
non-printable character, then caps the length to the firmware's
actual wire-format limits:
- name: 32 (firmware ESPHOME_DEVICE_NAME_MAX_LEN = 31, +1 margin)
- mac: 16 (firmware MAC_ADDRESS_BUFFER_SIZE - 1 = 12, +4 margin)
- explanation: 64 (firmware reject buffer is 32, +32 margin)
The caps and helper are cdef-typed in the .pxd; MAX_NAME_LEN /
MAX_MAC_LEN / MAX_EXPLANATION_LEN are re-exported as Python-importable
aliases for tests, following the same MAX_PLAINTEXT_FRAME_SIZE pattern
in plain_text.py.
Fixes https://github.com/esphome/aioesphomeapi/issues/1655fix/sanitize-noise-hello-fields Latest Branches
0%
bluetoothbot:koan/sanitize-plaintext-hello 0%
bluetoothbot:koan/validate-ble-connection-params 0%
bluetoothbot:koan/redact-malformed-psk-log © 2026 CodSpeed Technology