↓ Skip to main content

Introduction to the ESP32-S31: Security - Conclusion

·9 mins·
Table of Contents
ESP32-S31-SECURITY - This article is part of a series.
Part 15: This Article

Conclusion
#

This workshop has connected ESP32-S31 security controls to the security objectives of a connected product and to selected technical concerns raised by the EU Cyber Resilience Act.

What you learned
#

After completing the finished workshop, you will have:

  • Reviewed the ESP32-S31 architecture and security capabilities
  • Distinguished SoC security features from product-level CRA compliance
  • Protected data in transit with TLS on the ESP32-S31-Function-CoreBoard-1
  • Built production firmware with no development options and ran it in the ESP32 emulator, so every eFuse burn happened on an emulated chip instead of your board
  • Encrypted NVS with an HMAC key that the SoC generates and burns on first boot
  • Enabled Secure Boot V2 with an RSA signing key, and watched the bootloader burn the key digest and disable ROM download mode and JTAG
  • Enabled flash encryption in release mode, protected the NVS keys with flash encryption, and confirmed that raw flash reads return ciphertext
  • Learned why the order of eFuse burns matters in production: an HMAC key has to be burned before Secure Boot or flash encryption runs
  • Optionally, added signed HTTPS OTA updates with app rollback (Assignment 5)
  • Optionally, provisioned a real board with the same image (real-board appendix)
  • Observed the instructor-led TLS power consumption Otii demo at the end of Assignment 1 (when offered)

Emulator vs production device
#

Assignments 2 to 4 used the same production configuration you would ship. What differs is where the eFuses live:

TopicIn the emulatorOn a production device
eFusesBurned in emulator memory, blank again after a page reloadBurned in silicon, permanent
Secure Boot V2Real ROM and bootloader verification, digest in emulated BLOCK_KEY0Same flow, digest in real BLOCK_KEY0
Flash encryptionRelease mode, flash really encrypted in emulated flashRelease mode, flash encrypted with a key only the chip can use
NVS encryptionHMAC key generated on first boot (Assignment 2); NVS keys protected by flash encryption (Assignment 4)Scheme and key order chosen in the eFuse plan; HMAC keys burned from the host before the first secure boot
ROM download mode and JTAGDisabled in emulated eFusesDisabled for good; updates only through signed OTA
NetworkWi-Fi to the emulator access point, no internet in the web versionFull network access

The optional real-board appendix runs the Assignment 4 image on a board and lists what a production line adds. Signed OTA with app rollback is covered in the optional Assignment 5.

Security-control recap
#

ControlProtected assetsSecurity propertyHow you verified itDepends onResidual risk
TLS (Assignment 1)Data exchanged with the server, server identityConfidentiality and integrity in transit, server authenticationCertificate verified.; wrong-hostname and untrusted-server tests failAn up-to-date CA bundle, correct device timeAging CA bundle; the server does not authenticate the device unless you add mutual TLS
HMAC-based NVS encryption (Assignment 2)Wi-Fi credentials and configuration in NVSConfidentiality at restRaw NVS dump shows no plaintext credentials; HMAC_UP key in BLOCK_KEY0HMAC key burned with read protection before Secure Boot or flash encryptionData outside NVS is not covered; any code running on the device can still read NVS
Secure Boot V2 (Assignment 3)Bootloader and application imagesIntegrity and authenticity of firmwareSecure boot permanently enabled; digest in BLOCK_KEY0; ROM download mode and JTAG disabledCustody of the signing key, key digest in eFuseA leaked signing key lets an attacker sign firmware; NVS is plaintext in this lab
Flash encryption and NVS keys (Assignment 4)Code, data, and NVS keys in external flashConfidentiality against offline readsFlash encryption mode is RELEASE; raw read of storage returns ciphertext; raw NVS dump without plaintext credentialsRelease mode, encryption key in eFuse, nvs_keys partition marked encryptedCode running on the device can still read decrypted data; physical attacks are out of scope
Secure OTA (Assignment 5, optional)The update path and the running firmwareOnly authentic updates install; recovery from a bad updateSigned update installs; unsigned and wrongly signed images rejected; rollback testSecure Boot signing key, OTA server identityDowngrade to an older signed image is possible without anti-rollback

Assignments 2 to 5 ran the production configuration on an emulated ESP32-S31: the ROM, bootloader, and eFuse logic are the real ones, but the eFuses and flash are not silicon. The logs are valid evidence of the configuration and the boot flows. Evidence for a shipped product, such as a flash dump from a provisioned device, has to come from production hardware.

CRA-support mapping
#

Use this table as a starting template for the traceability part of your technical file. It links each product risk to an Annex I theme from the EU CRA overview, the control that addresses it, and the evidence and process that keep it working. Adapt the risks, owners, and evidence to your product and its risk assessment.

Product riskCRA themeDesign controlImplementation evidenceTest evidenceLifecycle processTypical owner
Eavesdropping or a fake serverProtection of data in transit, protection against unauthorized accessTLS with server certificate verificationsdkconfig (certificate bundle, verification required), trust store policySuccessful handshake log; wrong-hostname and untrusted-server failuresCA bundle updates through firmware releasesFirmware lead
Credential theft from a lost or stolen deviceData protection at restNVS encryption (HMAC-based or flash encryption-based scheme)NVS configuration, partition table, eFuse key block record per deviceRaw NVS dump without plaintext credentialsProvisioning record, key block plan, eFuse burn orderFirmware lead, manufacturing
Malicious or modified firmwareProtection against unauthorized access and misuseSecure Boot V2Signing configuration, key digest record, signing procedureBoot log with signature check; rejection of tampered and wrongly signed imagesSigning key custody, rotation, and revocation planSecurity lead
Firmware or data extraction from flashConfidentiality of stored dataFlash encryption in release modeFlash encryption mode, encrypted partition flagsRaw flash read shows ciphertext in the emulator and on a production deviceKey generation on the device, factory provisioning procedureSecurity lead, manufacturing
Known vulnerabilities stay in the fieldSecure update mechanismsSigned HTTPS OTA with app rollback, anti-rollback in productionOTA partition layout, rollback and secure version settingsSigned update installs; unsigned and wrongly signed updates rejected; rollback test; failed downgrade testRelease process, secure version policy, OTA server certificate rotationProduct owner, firmware lead
Vulnerabilities are not found or not handledVulnerability handling (Annex I Part II)Not a firmware control: SBOM, monitoring of advisories, disclosure policySBOM (for example from esp-idf-sbom), disclosure policyRecords of advisories reviewed and fixes shippedCoordinated disclosure, reporting through the ENISA Single Reporting PlatformProduct owner, security lead
Important

Successful completion of these exercises does not establish CRA conformity. A finished product also requires a documented risk assessment, secure defaults, vulnerability handling, update and support processes, technical documentation, conformity assessment, and fulfillment of all other applicable obligations.

Production-readiness checklist
#

The Assignment 4 configuration already has production settings. Use this list for what a product needs beyond it. The real-board appendix shows the first provisioning of a board and what a production line adds.

Design and keys
#

  • Product threat model and security requirements approved
  • Production keys generated and protected outside source control
  • Release images signed in a controlled environment, such as an offline machine or an HSM, never on developer laptops
  • Signing-key rotation and revocation plan defined; unused Secure Boot digest slots revoked
  • Anti-rollback secure version policy decided before the first release
  • OTA server certificate issued by a CA you control or a public CA, with a plan to rotate it before it expires

Manufacturing and device configuration
#

  • No development options in release builds: CONFIG_EFUSE_VIRTUAL not set, flash encryption in release mode, Secure Boot V2 enabled
  • eFuse key block plan and burn order recorded (Secure Boot digest, flash encryption key, HMAC key if used); HMAC keys burned before the first secure boot
  • Per-device credentials written into encrypted NVS during provisioning, not compiled into the firmware from menuconfig
  • Partition table offset sized for the final bootloader, including Secure Boot, flash encryption, and anti-rollback
  • UART download mode set to Secure or disabled, and JTAG disabled, according to policy
  • Provisioning process controlled, logged, and tested
  • Secure Boot, encryption, storage, TLS, and update controls verified on production-provisioned hardware

Lifecycle and compliance
#

  • Recovery and signing-key-compromise procedures tested
  • Vulnerability disclosure and remediation processes operating
  • Software bill of materials and third-party dependencies maintained
  • Support period, update policy, and end-of-life process documented
  • Compliance evidence reviewed by appropriate technical and legal experts

Limitations and next steps
#

Limits of the workshop
#

  • Assignments 2 to 5 ran on an emulated chip. The emulator does not model physical attacks such as fault injection, side channels, or probing the flash bus, so the labs show the configuration and the boot flows, not resistance to those attacks.
  • The web emulator has no internet access, so TLS was tested only on the board in Assignment 1.
  • Each web emulator run starts from blank eFuses, so every assignment image has to work on a new chip. That is why Assignment 3 runs without NVS encryption, and Assignment 4 protects the NVS keys with flash encryption instead of an HMAC key.
  • The lab firmware compiles the Wi-Fi credentials from menuconfig into the app; a product provisions them per device.
  • There is no hands-on lab for bootloader OTA or anti-rollback.
  • ESP32-S31 is a preview target in ESP-IDF v6.1. Check the documentation of your ESP-IDF release before you plan a product.

Topics not covered
#

A complete product security program also needs work on:

  • Authorization and access control: user roles, device pairing, and local or remote administration
  • Cloud and backend security: device identity, provisioning to a cloud service, and companion apps
  • Physical security: enclosure, debug headers, and tamper resistance
  • Radio and safety obligations, such as the Radio Equipment Directive and EN 18031
  • Manufacturing security: factory network, key injection stations, and operator access
  • Penetration testing by an independent team
  • Incident response: detection, triage, user notification, and reporting
  • Conformity assessment: product classification, Notified Body involvement, EU Declaration of Conformity, and CE marking

Further reading
#

ESP-IDF documentation for ESP32-S31:

ESP32 emulator:

ESP-IDF examples used or referenced in the workshop:

Product security and the CRA:

Navigation#

Previous: Assignment 5 (optional) or Assignment 4

Optional: Provision a real board (permanent)

Return to the workshop main page

ESP32-S31-SECURITY - This article is part of a series.
Part 15: This Article

Related