- December 01, 2025
Not enough time? Get the key points instantly.
Your smart home device is ready for production. The hardware passed EMC testing. The firmware handles the core use case correctly. The companion app connects cleanly. Then someone on the security review asks: what happens if someone intercepts the BLE pairing? What happens if a fake firmware update is pushed to a device in the field? What happens if the API token stored on the device gets extracted by someone with physical access?
Most teams cannot answer these questions before launch because security was never part of the architecture. It was an afterthought for a later sprint that never arrived. After launch, fixing a security gap means a firmware update campaign, an app store submission, a backend change, and a user notification. All four at once. All four at once. On devices already in users' homes.
By the end of this post, you will know how to secure smart home devices at the firmware level, the wireless layer, the OTA update channel, and the cloud connection. All of this before the first unit ships.
Security gaps in smart home products almost never appear during development testing. They appear six months after launch. A researcher publishes a writeup showing how they extracted credentials from flash memory. Or how they replayed a BLE packet to control the device without authentication.
By that point, fixing it costs orders of magnitude more than building it in correctly. The gap never closes on its own.
Three architectural decisions made early determine whether a smart home device is defensible after launch:
Secure boot. If the processor does not verify the firmware signature before executing it, any attacker with physical access can run arbitrary code on it. Secure boot is a processor-level capability. Enabling it requires a key provisioning step during manufacturing. Skipping it and planning to add it later is not possible. It requires a firmware respin and a manufacturing process change.
Authenticated and encrypted OTA. An OTA update channel that accepts any firmware image without verifying its origin is an open door. A device that downloads firmware over HTTP without verifying the image signature before writing to flash is open to remote takeover. This is not a rare edge case. It is one of the most common attack vectors on production IoT devices.
Credential storage. API keys, cloud connection tokens, and Wi-Fi passwords sitting in plaintext flash memory are readable by anyone with physical access and a basic flash reader. Encrypting sensitive credentials using the processor's hardware security features protects them even if the device is physically compromised.
Getting all three right before the first production run is how you secure smart home devices without paying for it twice. Getting them wrong costs a product recall, a security advisory, and customer trust that does not come back.
Secure boot is the foundation of any effort to secure smart home devices. Without it, every other security layer can be bypassed by replacing the firmware. With it, the device only runs code signed by a key you control.
How it works in practice: during manufacturing, a public key is burned into the processor's one-time programmable memory. On every boot, the processor verifies the firmware signature against that key before executing anything. If the signature fails, the device refuses to start.
The nRF52840, ESP32-S3, and STM32L4 all support hardware-backed secure boot. Most production-grade IoT processors do. The implementation requires generating a signing key pair, integrating the signing step into the firmware build process, and configuring the processor to enforce signature verification during manufacturing.
What the manufacturing process needs to include:
Key generation and secure storage, handled before production begins
A signing step in the firmware build pipeline that produces a signed image
A provisioning step during board flashing that burns the public key and enables secure boot
A test to verify the secure boot configuration before the device leaves the line
On one connected home device project, secure boot was initially planned for a post-launch firmware update. After reviewing the attack surface, the team confirmed that enabling secure boot after launch would require physical access to each device already in the field. The decision was made to implement it before first production. The manufacturing process change took three days.
BLE is the most common wireless interface in smart home devices: used for initial provisioning, firmware configuration, and often as the primary control channel. It is also the most commonly misconfigured.
Pairing mode vulnerabilities
The biggest BLE security mistake when you secure smart home devices is leaving the device in an open advertising mode where any central device can connect and write to GATT characteristics without authentication. A device that accepts any BLE connection without verifying the connecting device's identity can be controlled by anyone within radio range.
The correct approach depends on the use case. For consumer devices where users pair from a companion app:
Use BLE Secure Connections (LE Secure Connections pairing) rather than the legacy pairing model, because it provides protection against passive eavesdropping and man-in-the-middle attacks during the pairing exchange
Implement a pairing window: the device only accepts pairing requests for a limited time after a physical button press, not continuously
Use bonding to store the long-term key after first pairing, so subsequent connections do not require repeating the full pairing exchange
GATT characteristic access control
After pairing, GATT characteristic access still needs to be controlled. Characteristics that change device behaviour or expose sensitive data must require an authenticated and encrypted connection. Characteristics that only provide status information can be readable without authentication if the information is not sensitive.
A common mistake: firmware that skips the authentication check before processing a write to a control characteristic. This allows an attacker who connects without completing the pairing process to send control commands.
BLE communication encryption
BLE Secure Connections uses AES-CCM encryption after pairing. The key exchange uses elliptic curve cryptography. Once a bonded connection is established, all communication is encrypted. The firmware does not need additional application-layer encryption if it uses Secure Connections correctly, but it must still enforce that writes to sensitive characteristics are rejected on unencrypted connections.
BLE Security Consideration | Correct Approach | Common Mistake |
|---|---|---|
Pairing model | LE Secure Connections | Legacy JustWorks with no authentication |
Pairing window | Time-limited after button press | Always-on advertising with open pairing |
Characteristic access | Require authenticated, encrypted connection | Accept writes without checking connection state |
Bonding | Store long-term key after first pair | Re-pair on every connection |
Control channel | Reject unencrypted writes to control characteristics | Accept writes regardless of encryption state |
OTA updates are both a security feature and a security risk. They let you patch vulnerabilities after launch. They are also a vector for injecting malicious firmware if the update channel is not secured.
Signature verification before any update is applied
Every firmware image delivered over OTA must be verified against a signing key before it is written to flash. Verification happens on the device, not on the server. A server-side check is insufficient because an attacker who controls the network path between the server and the device can intercept and replace the image.
The OTA signing key must differ from the secure boot signing key. If both are the same key, compromising the OTA signing key also compromises the secure boot chain.
Transport security
OTA updates must be delivered over HTTPS. An OTA update channel that uses HTTP is vulnerable to a man-in-the-middle attack where the attacker intercepts the update request and serves a different image. HTTPS provides encryption and server authentication, confirming the device is talking to the legitimate update server rather than an impersonator.
Rollback protection
An OTA update system without rollback protection can be exploited by serving an older, vulnerable firmware version. If a device accepts any signed firmware image regardless of version number, an attacker who has a signed copy of an older version with a known vulnerability can downgrade the device to that version.
Rollback protection works by storing the current firmware version number in a protected location and refusing to install any image with a lower version number. The nRF52840's bootloader (MCUboot) and the ESP32's native OTA system both support rollback protection.
What a secure OTA pipeline looks like:
Build produces signed firmware image using offline signing key
Signed image is uploaded to update server
Device checks for update over HTTPS, verifying the server certificate
Device downloads the signed image
Device verifies the image signature before writing anything to flash
Device checks the version number against rollback protection threshold
Device writes the image to the staging partition
Device reboots and verifies the new firmware before marking it as active
If verification fails, device rolls back to the previous known-good firmware
Smart home devices store credentials an attacker wants: Wi-Fi passwords, cloud API tokens, device certificates, and sometimes user account tokens. Plaintext flash memory means anyone with physical access and basic tools can extract them.
Use hardware-backed key storage
Modern IoT processors include hardware security features for protecting cryptographic keys and sensitive data. The nRF52840's CRYPTOCELL, the ESP32's eFuse, and the STM32's TZEN all provide hardware-backed storage that makes key extraction significantly harder than reading plaintext flash.
Credentials that need storage on the device must be encrypted. Use a device-unique key stored in protected hardware memory. The device-unique key never leaves the hardware security module. The encrypted credentials in flash are useless without it.
Separate what needs to be stored from what can be derived
Not every credential needs to be stored. A device that authenticates to a cloud service can use a device certificate issued at manufacture rather than storing a password. The private key lives in the hardware security module. The certificate itself is public. Compromise of the device's flash memory does not expose the private key.
Wi-Fi credentials
Wi-Fi credentials provisioned during setup need to be stored on the device so it can reconnect after power cycling. These should be stored encrypted, using a key tied to the device's hardware identity. A device storing Wi-Fi credentials in plaintext flash exposes them to anyone who opens the device.
Credential Type | Storage Approach | Risk if plaintext |
|---|---|---|
Wi-Fi Password | Encrypted, device-unique key | Home network exposed to local attacker |
Cloud API token | Encrypted, or use certificate auth | Cloud account accessible without authentication |
Device certificate private key | Hardware security module only | Device identity can be cloned |
OTA signing public key | Flash (read-only region) | Not sensitive — public key does not need protection |
Run through this checklist on every project that needs to secure smart home devices before first production.
Secure boot:
Signing key pair generated and stored securely offline
Firmware build pipeline includes signing step
Manufacturing process includes key provisioning and secure boot enablement
Post-manufacture test confirms secure boot is active on every unit
BLE security:
LE Secure Connections pairing implemented, not legacy pairing
Pairing window is time-limited and triggered by physical action
GATT characteristics require authenticated, encrypted connection for writes
Unencrypted writes to control characteristics are rejected
OTA security:
All firmware images signed with an offline key before distribution
OTA transport uses HTTPS with server certificate verification
Device verifies image signature before writing to flash
Rollback protection prevents downgrade to older firmware versions
Staging partition model used — active firmware not overwritten until new image verified
Credential storage:
No plaintext credentials stored in flash
Wi-Fi credentials encrypted using device-unique hardware key
Cloud authentication uses certificate-based auth or encrypted token storage
Private keys stored in hardware security module, not accessible to application firmware
Secure boot is the most important because it is the foundation everything else depends on. Without secure boot, an attacker who gains access to the OTA channel or physical access to the device can replace the firmware with code that bypasses every other security layer. With secure boot, the device only runs code signed by a key you control, which means any other compromise requires overcoming the secure boot chain first. It is also the hardest to add after launch because it requires both a firmware change and a manufacturing process change.
Use LE Secure Connections pairing rather than legacy JustWorks pairing, because LE Secure Connections provides cryptographic protection against eavesdropping during the pairing exchange. After pairing, enforce that writes to GATT characteristics controlling device behaviour require an authenticated and encrypted connection. Reject any write that arrives on an unencrypted link. Limit the pairing window to a short time after a physical action on the device rather than leaving the device always discoverable and connectable.
Secure boot verifies firmware integrity at boot time, before the processor executes any code. OTA signature verification happens when a new firmware image is received, before it is written to the device's storage. Both are necessary because they protect different attack surfaces. Secure boot protects against someone who has already placed a malicious image in the device's flash. OTA signature verification protects against someone who intercepts the update channel and tries to serve a malicious image. A device needs both.
Wi-Fi passwords and cloud API tokens should be encrypted before being written to flash, using a device-unique key stored in the processor's hardware security features rather than in readable memory. For cloud authentication, certificate-based authentication is more secure than stored tokens because the private key never leaves the hardware security module. The device authenticates by performing a cryptographic operation with the private key rather than by transmitting a password or token.
Both, depending on implementation. A poorly implemented OTA channel (one that accepts unsigned images, uses HTTP, or has no rollback protection) is a significant security vulnerability. A well-implemented OTA channel (signed images, HTTPS transport, server certificate verification, rollback protection) is one of the most valuable security tools available because it lets you patch vulnerabilities after launch without physical access to the devices. The goal is to implement OTA correctly from the start so it remains a security asset rather than becoming a liability.
Implementing secure boot, BLE Secure Connections pairing, signed OTA, and encrypted credential storage from the start adds approximately 2 to 3 weeks to a typical smart home firmware development project. Adding the same features to a product already in production, after a security audit identifies gaps, typically adds 6 to 12 weeks because changes at multiple layers need to be coordinated and validated without disrupting devices already in users' homes. The earlier security architecture decisions are made, the lower the total cost.