Embedded Security Basics: Secure Boot, Debug Locking and Key Storage
An embedded device sits in the hands of whoever owns it, including people who want to copy it, modify it or use it to reach your servers. Encryption on the network link does little if the firmware can be read out of the chip or replaced with a modified copy. This article covers three foundations of device security: verifying what boots, closing the debug port and keeping keys where they cannot be read.
At a glance
- ROM
- Secure boot starts in boot code that cannot be rewritten, so the first check cannot be bypassed.
- SWD / JTAG
- Debug ports that can read and write all memory unless they are locked in production.
- Per-device
- Unique keys per unit mean one extracted key compromises one device, not the fleet.
- OTP
- One-time programmable fuses hold key hashes and lock settings that cannot be reversed.
The problem
A production board shipped with its debug port open lets anyone with a low-cost probe dump the firmware, read stored credentials and load their own code. Locking it is usually one configuration step, often missed because development needs the port open.
Shared secrets are the other common failure. When every unit carries the same key or password, extracting it from one device opens every device and often the cloud service behind them.
Security that depends on nobody opening the enclosure is not security. Design as if the attacker has the board on their bench.
The chain of trust
Secure boot works in stages. Immutable boot code verifies the signature of the first-stage bootloader against a public key, or a hash of one, held in one-time programmable memory. That bootloader verifies the next stage in the same way, up to the application. The device holds only public keys for this; the private signing key never leaves your build infrastructure.
Each link has to be enforced, not just checked. If a failed verification merely logs a warning and continues, or if the debug port can rewrite the bootloader, the chain is broken.
What good looks like
List what an attacker with physical access could gain: firmware, credentials, code execution or a route to your servers.
Enable secure boot from immutable code, provision unique keys per device in production, and keep private signing keys in protected infrastructure.
Lock the debug port as part of the production programming step and verify the lock on every unit at end-of-line test.
| Location | Protects against | Notes |
|---|---|---|
| Internal flash, unprotected | Nothing | Readable through debug or a firmware dump |
| Flash with read-out protection | Readout over the debug port | Strength varies by part and lock level |
| OTP or eFuse | Modification after programming | Suits key hashes and lock settings |
| TrustZone secure world | Access from non-secure code | Needs a core with TrustZone, such as many Cortex-M33 parts |
| Secure element | Software and many physical attacks | Separate chip; keys never leave it |
A secure boot chain
- Boot ROM: Immutable code runs first
- Check key: Public key matches hash in OTP
- Bootloader: Signature verified, then runs
- Application: Verified by the bootloader
- Debug locked: No path around the chain
What it changes
Firmware Integrity
Only images you signed will run on the device.
IP Protection
Locked debug and read-out protection make copying the firmware far harder.
Contained Breaches
A key taken from one unit does not unlock the rest of the fleet.
Buyer Confidence
A clear security design answers the questions customers and regulators increasingly ask.
Where to go next
Decide how authorised service access will work after locking, such as authenticated debug where the part supports it, before locking the first unit.
Check permanent options carefully. Some lock levels cannot be undone, and a mistake in the provisioning script can leave units impossible to reprogram.
Problems this prevents
- Debug ports left open on shipped units
- One key or password shared across every device
- Private signing keys stored on the device
- Secure boot that warns but still boots
Discuss your project
Email support@aavico.com or use Get in Touch when the website finishes loading.