firmware icon indicating copy to clipboard operation
firmware copied to clipboard

fix(HeavyButter): power down radios during sleep and fix broken deep sleep (AV-002/003)

Open r13xr13 opened this issue 5 months ago • 0 comments

HeavyButter Security Audit — Fix AV-002 / AV-003

Finding AV-002 (Fake Sleep): When the user presses "Sleep," only the display backlight turns off. All radios (WiFi, BLE, Sub-GHz, NRF24, IR, RFID) stay powered and active. The device remains on the network.

Finding AV-003 (Broken Deep Sleep): DEEPSLEEP_WAKEUP_PIN defaulted to -1 in precompiler_flags.h:264, which disables deep sleep on any board that does not explicitly define it. Most boards do not.

Fixes:

  • include/precompiler_flags.h: Changed default DEEPSLEEP_WAKEUP_PIN from -1 to 0 (BOOT button, available on all ESP32 dev boards)
  • src/core/mykeyboard.cpp (goToDeepSleep()): Added WiFi.mode(WIFI_OFF) + esp_bt_controller_deinit() before entering deep sleep
  • src/core/settings.cpp (setSleepMode()): Same radio power-down before light sleep

Impact: Sleep now actually powers down radios. Deep sleep works on boards without explicit pin config. Device is no longer a persistent network beacon when the user thinks it is off.

Reference: Forensic audit issue #2511 — HeavyButter (r13xr13)

r13xr13 avatar Jun 08 '26 07:06 r13xr13