firmware icon indicating copy to clipboard operation
firmware copied to clipboard

fix(HeavyButter): encrypt sensitive bruce.conf fields at rest with AES-256-CBC

Open r13xr13 opened this issue 5 months ago • 0 comments

Summary

Encrypts sensitive credential fields in bruce.conf (stored on LittleFS/SD) using AES-256-CBC with a device-unique key derived from the MAC address.

Changes

  • Add encrypt_field() / decrypt_field() using mbedtls AES-256-CBC with PKCS#7 padding and random IV per field
  • Key derived from device MAC address via SHA-256 (derive_config_key())
  • Encrypted fields stored as IVhex:ciphertext_hex in JSON
  • Fields encrypted: webUI.user/pwd, wifiAp.ssid/pwd, all saved wifi passwords, wigleBasicToken, wdgwarsApiKey
  • is_encrypted() detector ensures backward compatibility with existing plaintext bruce.conf files
  • Plaintext configs load normally; next save triggers encryption

Security Impact

Before: All credentials (WiFi passwords, API keys) stored in plaintext on LittleFS/SD card. Anyone who reads the device filesystem gets all credentials.

After: Credentials encrypted at rest with a device-unique key. Physical filesystem access no longer reveals plaintext passwords.

r13xr13 avatar Jun 08 '26 07:06 r13xr13