Esp32 Wifi Provisioning

Provisioning is the one-time setup flow that gets a chip's Wi-Fi credentials from a user's phone into the device, and it has to solve a problem that sounds almost contradictory: the device isn't on the home Wi-Fi network yet, so it can't just receive the password over Wi-Fi the normal way — the chip has to open some other, non-Wi-Fi communication channel specifically to bootstrap the Wi-Fi connection it doesn't have yet. A brand-new smart plug out of the box knows nothing about the network it's about to join; BLE or a temporary SoftAP (the device briefly acting as its own Wi-Fi access point) exist specifically to give a phone app a way to talk to the device before that device has any real network connection of its own.

Device powers on with no stored Wi-Fi credentials
First boot, or after a factory reset
Provisioning channel — bootstrap before Wi-Fi exists
BLE advertising
Device advertises itself; phone app connects over BLE
SoftAP alternative
Device becomes a temporary Wi-Fi AP, phone connects directly to it
Credential transfer
App sends SSID + password
Encrypted over the provisioning channel, not sent in the clear
Device stores credentials
Written to flash, typically in the encrypted partition
Device joins the real Wi-Fi network and shuts down the provisioning channel
BLE/SoftAP closed — no longer needed or exposed

Encrypting the credential transfer over BLE or SoftAP matters precisely because this is the one moment the device is deliberately broadcasting an open invitation for a nearby phone to talk to it — which also makes it the one moment an attacker's phone could try the exact same thing. An unencrypted provisioning channel would let anyone within BLE or Wi-Fi range who understands the protocol simply listen in and capture a home network's password the instant a legitimate owner sets up their new device; real provisioning schemes establish a session key (often via a key-exchange step or a shared secret printed on the device, like a QR code) before the actual SSID and password are transmitted, so even an attacker sniffing the raw radio traffic sees only ciphertext rather than a plaintext Wi-Fi password.

Provisioning — Bootstrapping Wi-Fi Before Wi-Fi Exists a temporary, encrypted channel that closes itself once its one job is done Phone app Not yet connected to the target device has SSID + password ready BLE / SoftAP Provisioning channel Temporary, open to nearby devices only Session key established first Device Receives encrypted SSID + password Stores to encrypted flash The attack this has to defend against Any phone in BLE/Wi-Fi range can see the open provisioning advertisement Unencrypted transfer = home Wi-Fi password captured in plaintext Session key (QR code / key exchange) established before credentials are ever sent After successful provisioning BLE/SoftAP channel closes — no longer advertising, no longer exposed device now reachable only through the real Wi-Fi network it joined A one-time bootstrap channel, encrypted during use and closed the moment it's not needed

Closing the provisioning channel immediately after successful setup is as much a security decision as it is a cleanup step, because a BLE or SoftAP interface left open indefinitely is a permanent, unnecessary attack surface a deployed product should never carry. Once a device has joined the real network and no longer needs to receive credentials, there's no legitimate reason for it to keep advertising a BLE provisioning service or hosting a SoftAP — leaving either one running after setup is exactly the kind of lingering, unused capability a security review flags, since every open interface the chip exposes is one more thing an attacker could attempt to exploit, whether or not the device's owner ever needed it again.

The fallback path — what happens when provisioning fails partway through, or the stored credentials turn out to be wrong (the password changed, the router was replaced) — is where many provisioning implementations quietly fall short, because it's much easier to design the happy path than to design graceful recovery from a half-completed or now-invalid setup. A device that can't connect using its stored credentials needs a deliberate, discoverable way back into provisioning mode — typically a long-press button combination or a specific number of power cycles — rather than becoming a bricked, un-reconfigurable device the moment its one stored Wi-Fi network becomes unavailable; designing that re-entry path explicitly, and testing it as carefully as the initial setup flow, is what separates a provisioning scheme that works on a demo day from one that survives years of real households changing routers and passwords.

Provisioning is the first security-sensitive interaction a product has with its owner, and getting it right means solving three things together: a genuinely encrypted bootstrap channel that never transmits a home network's password in the clear, a channel that closes itself the instant it's done its one job rather than lingering as an open attack surface, and a reliable way back into setup mode when the stored credentials eventually stop working — the last of which is the part most likely to get skipped under a ship deadline and the part users notice most when it's missing.

Take esp32 wifi provisioning further

Ask the copilot about this term, or have our engineers assess it against your process.