Lightweight Two-Stage Secure Boot with Automatic Rollback for STM32 IoT Devices
Abstract
Secure firmware updates are critical for embedded and Internet of Things (IoT) devices, as any failure during the update process can render the system permanently unavailable. Existing secure boot solutions often depend on dedicated hardware security modules or offer only limited recovery mechanisms, which are impractical for low-cost, resource-constrained microcontrollers. This study presents a novel architecture for safe boot using a lightweight two-stage system withautomatic rollback features, implemented on an STM32 microcontroller. The system allocates security and update functions between two bootloaders (BL1 and BL2) via a metadata-governed state machine and dual-bank flash memory, thereby obviating the need for supplementary hardware. We have implemented common security protocols within this framework, including AES for encryption, SHA-256 for integrity verification, and RSA-2048 for authentication. We also added a Time-based One-Time Password (TOTP)-based Multi-Factor Authentication (MFA) system to safeguard data transmission over UART. Experimental results conducted on the STM32-F746 IoT hardware platform showed that the proposed solution achieved significant efficiency in boot data recovery across diverse error scenarios and effectively thwarted unauthorized attacks and system degradation. The performance parameters for total system boot delay ranged from 5 to 15.5 seconds, while public key authentication latency consistently remained below 258.8 ms. The suggested methodology is appropriate for IoT devices that use low-capacity microcontroller units, such as STM32 platforms. The findings validate that resource-limited IoT devices can attain strong security and assured system resilience without the need for specialist hardware.