UART bootloader security
Posted: Mon Aug 03, 2020 9:11 pm
Is the ROM serial bootloader for the ESP32 rev 3 reasonably secure if left enabled?
That is, if I set the efuses as follows:
Here, the flash decryption / encryption features are disabled (also not shown, secure boot v2 is enabled), but the UART bootloader is still able to download / upload the encrypted contents. I understand that the power supply glitching attack on rev 2 and earlier were able to bypass the decryption protection settings and that rev 3 has some mitigations and thus the absolute safest option would be to turn off the download mode entirely using UART_DOWNLOAD_DIS. However, if I want to retain the option to use the bootloader (using a saved per-device flash encryption key), is the rev 3 serial bootloader robust enough that flash encryption isn't thwarted by leaving the bootloader enabled?
For example, if someone were to use their own RAM flash programming stub, would it be able to read out the decrypted flash contents, or would it still be limited to seeing the encrypted flash the same way as the UART bootloader itself? Is it expected that an attacker would likely to be able to bypass the decryption protection settings on the rev 3 bootloader and that turning it off entirely is the only reliable way to preserve flash encryption, or can I trust that it is reasonably secure?
That is, if I set the efuses as follows:
Code: Select all
Efuse Name Description Value R/W
FLASH_CRYPT_CNT Flash encryption mode counter 127 R/-
UART_DOWNLOAD_DIS Disable UART download mode False R/-
FLASH_CRYPT_CONFIG Flash encryption config (key tweak bits) 15 R/-
CONSOLE_DEBUG_DISABLE Disable ROM BASIC interpreter fallback True R/-
JTAG_DISABLE Disable JTAG True R/-
DISABLE_DL_ENCRYPT Disable flash encryption in UART bootloader True R/-
DISABLE_DL_DECRYPT Disable flash decryption in UART bootloader True R/-
DISABLE_DL_CACHE Disable flash cache in UART bootloader True R/-
For example, if someone were to use their own RAM flash programming stub, would it be able to read out the decrypted flash contents, or would it still be limited to seeing the encrypted flash the same way as the UART bootloader itself? Is it expected that an attacker would likely to be able to bypass the decryption protection settings on the rev 3 bootloader and that turning it off entirely is the only reliable way to preserve flash encryption, or can I trust that it is reasonably secure?