STM32 microcontrollers implement several security mechanisms designed to protect sensitive data and firmware against unauthorized access. This thesis explores a vulnerability within the STM32 microcontroller family, with a focus on the STM32L5 Series, and explores methods to bypass one of these protections, the Readout Protection (RDP) Level 1. With RDP level 1, the debug interface remains active, but access to the flash memory of the board is limited. As soon as the debug interface is connected, the flash memory is locked. It cannot be read directly, through DMA, or by executing instructions from it. The protection level can be either raised to 2 or downgraded to 0, with the loss of the contents of the entire flash memory. The vulnerability to bypass this protection arises from an operation allowed by the board, specifically the manipulation of the Boot Address. This manipulation can be highly useful, for instance, when testing a new firmware version without deleting the stable one by changing the boot address to point to a test firmware. However, if this feature is implemented in certain contexts, such as a firmware that requires saving data in the board's non-volatile flash memory, e.g a password, it opens the door to a malicious user who can perform code injection. This would allow the execution of malicious code, enabling unauthorized memory access and leading to the leakage or compromise of sensitive information that, in theory, should be protected by the restrictions imposed by Readout Protection (RDP) Level 1. Two main attack strategies are proposed to demonstrate the possibility of bypassing RDP Level 1: the first attack vector manipulates the control flow in flash memory to execute unauthorized code, while the second leverages the ability to execute code in SRAM to avoid the need for writing to flash memory.
I microcontrollori STM32 implementano diversi meccanismi di sicurezza progettati per proteggere dati sensibili e firmware da accessi non autorizzati. Questa tesi esplora una vulnerabilità all'interno della famiglia di microcontrollori STM32, con particolare attenzione alla STM32L5 Series, e analizza i metodi per bypassare una di queste protezioni, il Livello 1 del Readout Protection (RDP). Con RDP livello 1, l'interfaccia di debug rimane attiva, ma l'accesso alla memoria flash della scheda è limitato. Non appena viene collegata l'interfaccia di debug, la memoria flash viene bloccata. Non può essere letta direttamente, tramite DMA, né eseguendo istruzioni dalla memoria stessa. Il livello di protezione può essere aumentato a 2 o ridotto a 0, con la perdita del contenuto dell'intera memoria flash. La vulnerabilità che permette di aggirare questa protezione deriva da un'operazione consentita dalla scheda, in particolare la manipolazione dell'indirizzo di avvio (Boot Address). Questa manipolazione può essere molto utile, ad esempio, quando si testa una nuova versione del firmware senza eliminare quella stabile, cambiando l'indirizzo di avvio per puntare al firmware di test. Tuttavia, se implementata in determinati contesti, come in un firmware che richiede di salvare dati nella memoria flash non volatile della scheda (ad esempio, una password), apre le porte ad utenti malintenzionati, permettendo iniezione di codice. Ciò consentirebbe l'esecuzione di codice malevolo, permettendo l'accesso non autorizzato alla memoria e portando alla perdita o compromissione di informazioni sensibili che, in teoria, dovrebbero essere protette dalle restrizioni imposte dall'RDP di livello 1. Due strategie principali di attacco vengono proposte per dimostrare la possibilità di bypassare l'RDP di livello 1: la prima manipola il flusso di controllo nella memoria flash per eseguire codice non autorizzato, mentre la seconda sfrutta la possibilità di eseguire codice nella memoria SRAM, evitando così la necessità di scrivere nella memoria flash.
Bypassing Readout Protection Level 1 on STM32L5 Series
Sposito, Antonino
2023/2024
Abstract
STM32 microcontrollers implement several security mechanisms designed to protect sensitive data and firmware against unauthorized access. This thesis explores a vulnerability within the STM32 microcontroller family, with a focus on the STM32L5 Series, and explores methods to bypass one of these protections, the Readout Protection (RDP) Level 1. With RDP level 1, the debug interface remains active, but access to the flash memory of the board is limited. As soon as the debug interface is connected, the flash memory is locked. It cannot be read directly, through DMA, or by executing instructions from it. The protection level can be either raised to 2 or downgraded to 0, with the loss of the contents of the entire flash memory. The vulnerability to bypass this protection arises from an operation allowed by the board, specifically the manipulation of the Boot Address. This manipulation can be highly useful, for instance, when testing a new firmware version without deleting the stable one by changing the boot address to point to a test firmware. However, if this feature is implemented in certain contexts, such as a firmware that requires saving data in the board's non-volatile flash memory, e.g a password, it opens the door to a malicious user who can perform code injection. This would allow the execution of malicious code, enabling unauthorized memory access and leading to the leakage or compromise of sensitive information that, in theory, should be protected by the restrictions imposed by Readout Protection (RDP) Level 1. Two main attack strategies are proposed to demonstrate the possibility of bypassing RDP Level 1: the first attack vector manipulates the control flow in flash memory to execute unauthorized code, while the second leverages the ability to execute code in SRAM to avoid the need for writing to flash memory.File | Dimensione | Formato | |
---|---|---|---|
2024_10_Sposito_Executive_Summary.pdf
non accessibile
Descrizione: executive summary
Dimensione
534.06 kB
Formato
Adobe PDF
|
534.06 kB | Adobe PDF | Visualizza/Apri |
2024_10_Sposito_Thesis.pdf
non accessibile
Descrizione: testo tesi
Dimensione
2.85 MB
Formato
Adobe PDF
|
2.85 MB | Adobe PDF | Visualizza/Apri |
I documenti in POLITesi sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.
https://hdl.handle.net/10589/227934