Feature request — keyless field re-flashing with mandatory erase-first, and reads fully disabled
Posted: Mon Jul 13, 2026 6:59 pm
Good morning everyone.
I'm building a commercial ESP32-based product that is physically exposed — it's installed in a street-facing box, so an attacker can reach the USB/serial pins. This creates a specific pair of needs that, as far as I can tell, no current configuration satisfies together.
What I need
1. A third party must never be able to read the stored Wi-Fi credentials, whether by esptool read_flash over serial/native USB, or by clipping onto / desoldering the flash chip and reading it externally.
2. Anyone should be able to re-flash the device in the field with their own firmware, without needing any key from me — because I want the product to be freely customizable.
At first glance these look contradictory, but I think there's a clean model that resolves them.
The proposed model
Two pieces working together:
1. Encryption key in an eFuse, inside the ESP32 — never in flash. The key is unreadable by software and, crucially, it does not live on the external flash chip. So desoldering the flash and reading it externally yields only ciphertext; the key simply isn't there to find. This part already exists in Flash Encryption and is exactly what I want.
2. A command-discriminating gatekeeper in the boot path that:
2.1 Refuses all read operations, unconditionally. There is no way to read flash contents back out over the serial/USB interface.
2.2 Allows writes with no key required — but only after a mandatory full erase of the NVS/credential region. Re-flashing is always permitted, but the act of re-flashing wipes the stored credentials first, before the new firmware is accepted.
The result: a stolen/exposed device gives up nothing. An attacker can re-flash it freely (keyless), but the erase-first guarantees the previous owner's credentials are gone before any new code runs. And direct reads are refused outright, while pin/desolder reads only ever see encrypted data because the key is in the eFuse.
Why current modes don't cover this
Flash Encryption Development mode: re-flashing is keyless ✓, but read_flash over serial returns plaintext ✗ — so credentials are exposed on the exact interface an attacker reaches.
Flash Encryption Release mode: reads are blocked ✓, but re-flashing over serial requires a pre-encrypted image using the per-device key ✗ — so keyless field re-flashing is impossible.
Neither mode offers the combination I need: keyless re-flash (with forced erase) AND reads fully disabled.
My questions
a. Is there any existing eFuse / secure-download-mode combination that achieves this behavior that I've missed?
b. If not, is a "wipe-on-write, deny-on-read" download mode something that could be considered? It seems like it would serve any exposed/tamper-accessible product that wants to remain user-customizable without leaking prior secrets.
Thanks in advance.
I'm building a commercial ESP32-based product that is physically exposed — it's installed in a street-facing box, so an attacker can reach the USB/serial pins. This creates a specific pair of needs that, as far as I can tell, no current configuration satisfies together.
What I need
1. A third party must never be able to read the stored Wi-Fi credentials, whether by esptool read_flash over serial/native USB, or by clipping onto / desoldering the flash chip and reading it externally.
2. Anyone should be able to re-flash the device in the field with their own firmware, without needing any key from me — because I want the product to be freely customizable.
At first glance these look contradictory, but I think there's a clean model that resolves them.
The proposed model
Two pieces working together:
1. Encryption key in an eFuse, inside the ESP32 — never in flash. The key is unreadable by software and, crucially, it does not live on the external flash chip. So desoldering the flash and reading it externally yields only ciphertext; the key simply isn't there to find. This part already exists in Flash Encryption and is exactly what I want.
2. A command-discriminating gatekeeper in the boot path that:
2.1 Refuses all read operations, unconditionally. There is no way to read flash contents back out over the serial/USB interface.
2.2 Allows writes with no key required — but only after a mandatory full erase of the NVS/credential region. Re-flashing is always permitted, but the act of re-flashing wipes the stored credentials first, before the new firmware is accepted.
The result: a stolen/exposed device gives up nothing. An attacker can re-flash it freely (keyless), but the erase-first guarantees the previous owner's credentials are gone before any new code runs. And direct reads are refused outright, while pin/desolder reads only ever see encrypted data because the key is in the eFuse.
Why current modes don't cover this
Flash Encryption Development mode: re-flashing is keyless ✓, but read_flash over serial returns plaintext ✗ — so credentials are exposed on the exact interface an attacker reaches.
Flash Encryption Release mode: reads are blocked ✓, but re-flashing over serial requires a pre-encrypted image using the per-device key ✗ — so keyless field re-flashing is impossible.
Neither mode offers the combination I need: keyless re-flash (with forced erase) AND reads fully disabled.
My questions
a. Is there any existing eFuse / secure-download-mode combination that achieves this behavior that I've missed?
b. If not, is a "wipe-on-write, deny-on-read" download mode something that could be considered? It seems like it would serve any exposed/tamper-accessible product that wants to remain user-customizable without leaking prior secrets.
Thanks in advance.