Skip to content

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

Open
r13xr13 wants to merge 1 commit into
BruceDevices:mainfrom
r13xr13:fix/creds-encryption-heavybutter
Open

fix(HeavyButter): encrypt sensitive bruce.conf fields at rest with AES-256-CBC#2524
r13xr13 wants to merge 1 commit into
BruceDevices:mainfrom
r13xr13:fix/creds-encryption-heavybutter

Conversation

@r13xr13

@r13xr13 r13xr13 commented Jun 8, 2026

Copy link
Copy Markdown

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.

…6-CBC

- Derive AES-256 key from device MAC address via SHA-256
- Encrypt webUI creds, wifiAp creds, saved wifi passwords, API tokens
- PKCS#7 padding, random IV per field, hex-encoded storage
- Backward compatible: detects encrypted vs plaintext on load
- Existing plaintext configs continue to work, re-save triggers encryption
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant