Skip to content

Lesson 9 of 14 · 12m

The Anti-Patterns in OTA

HTTP downloads, checksums over the same channel, verify-after-write — and why payload signing beats transport trust.

Firmware updates fail in a small set of ways that keep repeating across vendors, because they all grow from the same wrong model: trusting the channel instead of the payload.

The anti-pattern catalog

  • HTTP download. The image crosses the network unprotected; anyone on-path — hostile ISP segment, rogue AP, ARP-poisoned LAN — swaps it. Devices that "check the file" against a hash fetched from the same server get the attacker's hash too.
  • Checksum over the same channel. The updater fetches fw.bin then fw.bin.md5 from the same endpoint and compares. Both artifacts come from the same trust domain. Replace one, replace both. Integrity proven against attacker-controlled data proves nothing.
  • CRC32 as integrity. CRC is an error-detection code for line noise, not an adversarial control. It can't distinguish corruption from forgery.
  • Verify-after-write. Checking the signature after the image is already in flash means the write primitive was exercised unauthenticated — the damage is in the write, not the boot. An attacker who can reach the write path has already won persistence; a signature check that runs afterward is incident response, not prevention.
  • The web upload form. Consumer routers frequently accept unsigned firmware through the admin UI. Researchers flash crafted images through the vendor's own upload page routinely — the write primitive ships authenticated only by the web login, which is the same credential Mirai was attacking.
  • Unsigned bootloader path. The kernel verifies signatures but the bootloader doesn't — or the bootloader accepts tftpboot-loaded images from any console. Verification that starts at stage two of a two-stage boot verifies nothing.

Why "just use TLS" is the wrong model

TLS proves the server you reached holds a certificate for a domain name. It does not prove the payload is the firmware your vendor intends your device to run. Compromised update servers, re-registered expired domains, and devices without a real-time clock that can't evaluate certificate validity all pass through "valid TLS." TLS authenticates a channel; you need the artifact authenticated regardless of channel.

What signing actually binds

The correct mechanism is payload signing, and it is worth being precise about what it proves: the vendor signs the image plus a manifest with a private key held in the build infrastructure — Ed25519 or ECDSA-P256 — and devices verify the signature against a public key burned in at manufacture. No key on the device can forge; verification is a few hundred milliseconds of math.

The manifest is load-bearing: model, hardware compatibility, version, minimum-version. Sign it together with the image. An attacker who can mix firmware file A with manifest B has an oracle — model-confusion and rollback attacks live in unsigned metadata.

The tradeoff stated honestly

Signing costs build-side key custody: an offline or HSM-held release key, separation between dev signing and release signing, and a revocation story for the day a key leaks. That's real ops burden — a lost or leaked signing key is a product-defining incident. On-device verification is essentially free: a few hundred milliseconds of ECDSA and a baked-in public key. The calculus favors signing in every case where the alternative is "the transport was trusted."

Practice

A correct updater: fetch over whatever transport, verify the signature against the baked key, check the manifest against model and version floor, then write — atomically, ideally to an inactive A/B slot. Verification happens before the write primitive runs, every time, in every code path — including the web upload form and the bootloader console. If you can't get a signed payload past a hostile network, TLS was never going to save you anyway.

Was this lesson helpful?

Sign in to rate

Keep reading

Related articles from the SudoSecurity blog.