Application note

Introduction to security for STM32 MCUs

Rev 14 - June 2026

Introduction

This application note presents the basics of security in STM32 microcontrollers.

Security in microcontrollers encompasses several aspects including protection of firmware intellectual property, protection of private data in the device, and guarantee of a service execution.

The context of IoT has made security even more important. The huge number of connected devices makes them an attractive target for attackers and several remote attacks have shown the vulnerabilities of device communication channels. With IoT, the security extends the requirements for confidentiality and authentication to communication channels, which often require encryption.

This document is intended to help the building of a secure system by applying countermeasures to different types of attack.

In the first part, after a quick overview of different types of threats, examples of typical attacks are presented to show how attackers exploit the different vulnerabilities in an embedded system.

The subsequent sections focus on the set of hardware and software protections that defend the system from these attacks.

The last sections list all security features available in the STM32 series, and guidelines are given to build a secure system.

Table 1. Applicable products
TypeProduct series
MicrocontrollersSTM32C0, STM32C5, STM32F0, STM32F1, STM32F2, STM32F3, STM32F4, STM32F7, STM32G0, STM32G4, STM32H5, STM32H7, STM32L0, STM32L1, STM32L4, STM32L4+, STM32L5, STM32N6, STM32U0, STM32U3, STM32U5, STM32WB, STM32WBA, STM32WB0, STM32WL.

General information

This document applies to STM32 Arm® Cortex®-core based microcontrollers.

Note:

Arm and Cortex are registered trademarks of Arm Limited (or its subsidiaries or affiliates) in the US and/or elsewhere.

The Arm word and logo are trademarks of Arm Limited (or its subsidiaries) in the US and/or elsewhere. All rights reserved.

 

 

The table below presents a nonexhaustive list of the acronyms used in this document and their definitions.

Table 2. Glossary
TermDefinition
AESAdvanced encryption standard
CCMCore-coupled memory (SRAM)
CPUCentral processing unit–core of the microcontroller
CSSClock security system
DoSDenial of service (attack)
DRNG Deterministic random number generator: generates pseudo-random number from input value
DPADifferential power analysis
ECCError code correction
FIAFault injection attack
FIBFocused ion beam
GTZCGlobal TrustZone® controller
HDPSecure hide protection
HUKHardware unique key
IAPIn-application programming
IATInitial attestation token
IoTInternet of things
IVInitialization vector (cryptographic algorithms)
IWDGIndependent watchdog
MACMessage authentication code
MCUMicrocontroller unit (STM32 Arm® Cortex®-M based devices)
MPCBBMemory protection block-based controller
MPCWMMemory protection watermark-based controller
MPUMemory protection unit
NSCNonsecure callable
NVMNonvolatile memory
OTFDECOn-the-fly decryption
OTPOne-time programmable
PCROPProprietary code readout protection
PKAPublic key algorithm (also named aka asymmetric algorithm)
PSAPlatform security architecture
PVDProgrammable voltage detector
PWRPower control
ROMRead only memory–system flash memory in STM32
RoTRoot of trust
RDPRead protection
RIFResource isolation framework
RSSRoot secure services
RTCReal-time clock
SAUSecurity attribution unit
SBSecure boot
SCASide channel attack
SDRAMSynchronous dynamic random access memory
SECDEDECC mode of operation: single error correct, double error detect
SFISecure firmware installation
SFUSecure firmware update
SPASimple power analysis
SPESecure processing environment
SRAMStatic random access memory (volatile)
SSTSecure storage
STSAFESecure element product from STMicroelectronics portfolio
SWDSerial-wire debug
TF-MTrusted firmware-M
WRPWrite protection

Documentation references

The reference manual of each device gives details on the availability of security features. It also informs about memory protections implementation.

A programming manual is also available for each Arm® Cortex® version and can be used for an MPU (memory protection unit) description:
  • STM32 Cortex®-M33 MCUs programming manual (PM0264)
  • STM32F7 series and STM32H7 series Cortex®-M7 processor programming manual (PM0253)
  • STM32 Cortex®-M4 MCUs and MPUs programming manual (PM0214)
  • STM32F10xxx/20xxx/21xxx/L1xxxx Cortex®-M3 programming manual (PM0056)
  • Cortex®-M0+ programming manual for STM32L0, STM32G0, STM32WL, STM32WB, and STM32WB0 series (PM0223)

Refer to the following set of user manuals and application notes (available on www.st.com) for detailed description of security features:

Ref.Doc numberTitleComment
[1]AN4246Proprietary code readout protection on STM32L1 series MCUsExplains how to set up and work with PCROP firmware for the specified MCUs, provided with the X‑CUBE‑PCROP expansion package.
[2]AN4701Proprietary code readout protection on STM32F4 series MCUs
[3]AN4758Proprietary code readout protection on STM32L4, STM32L4+, STM32G4, and STM32WB series MCUs
[4]AN4968Proprietary code readout protection on STM32F72/F73xx MCUs
[5]AN4838Managing memory protection unit (MPU) in STM32 MCUsDescribes how to manage the MPU in the STM32 products.
[6]AN5185STMicroelectronics firmware upgrade services for STM32WB series-
[7]AN5447Overview of secure boot and secure firmware update solution on Arm® TrustZone® STM32 MCUs-
[8]UM1924Legacy STM32 crypto libraryDescribes the API of the STM32 crypto library; provided with the X‑CUBE‑CRYPTOLIB expansion package.
[9]UM2262Getting started with the X-CUBE-SBSFU STM32Cube expansion packagePresents the SB (secure boot) and SFU (secure firmware update) STMicroelectronics solutions; provided with the X‑CUBE‑SBSFU expansion package.
[10]AN4730Using the firewall embedded in STM32L0/L4/L4+ series MCUsDescribes how to access securely sensitive parts of code and data
[11]AN6205Introduction to the use of PKA key wrapping with coupling and chaining bridge on STM32 MCUsThis AN focuses on use of CCB in STM32U3 series.
[12]AN6008Getting started with debug authentication (DA) for STM32 MCUsDescribes debugging selected STM32H5 and STM32H7 devices that support temporary opening on otherwise closed device.
[13]AN6014Introduction to SFSP versions for STM32H5 MCUsSystem flash security package (SFSP) is available on selected devices of STM32H5 series.
[14]AN6007Getting started with STiRoT (ST immutable Root of Trust) for STM32H5 MCUsIntroductory document about STM32H5 secure boot solution.
[15]AN5391Introduction to SFI tools, bootloader, and RSS interface for STM32 MCUsThis SFI‑related application note is not publicly available. Contact your ST sales representative to request it.
[16]AN5054How to perform secure programming using STM32CubeProgrammer-
[17]AN4992Introduction to secure firmware install (SFI) for STM32 MCUs-
[18]AN4657STM32 in-application programming (IAP) using the USART-
[19]AN5056How to integrate the X-CUBE-SBSFU STM32Cube Expansion Package-
[20]AN5544Integration guide of SBSFU on STM32CubeWL (including KMS)-

The ST wiki also offers vast resources on security topics, including detailed step-by-step guides on https://wiki.st.com/stm32mcu/wiki/Category:Security