Skip to content

Lesson 10 of 13 · 18m

Update Mechanisms and Rollback

Every OTA path already contains an installer for attacker code; signature placement and monotonic counters are what stand in front of it.

The installer is already shipped

The 'Firmware Update' button on a device means the device contains a write path to its own boot media. That path is the target; the signature check in front of it is the question. Most embedded designs converge on the same anatomy: an A/B or dual-bank layout with an atomic commit flag — Android's A/B slots, Mender, RAUC, SWUpdate — a recovery partition for the image that never gets overwritten, and a bootcount/upgrade_available handshake where the bootloader tries the new slot once and reverts if userspace never marks it good. On the PC side the same slot discipline exists as UEFI capsule update: signed capsule images handed to UpdateCapsule and applied by firmware at reboot, which is the path fwupd and Windows Update both drive.

The verification order is where these systems live or die. The signature must be checked by code the update path cannot itself rewrite: the mask ROM, the SPL/BL1 stage, U-Boot with its key baked into the control FDT, or a secure element. SWUpdate's .swu is a signed cpio; Mender and RAUC sign the artifact manifest. All correct — when verification happens in a stage below the flashed payload. The failure shape everyone eventually meets in a real product: a userspace update agent verifies the signature, then hands a raw image to the flashing routine. That agent is part of the updatable payload. An attacker who gets one image through — an old signed one, a stolen-key signed one — ships an agent that stops verifying. The same trap hides in the metadata: signing the payload but not the manifest leaves version, partition table, and rollback fields attacker-malleable.

TOCTOU is the second failure: verify the file, then re-read it for flashing from attacker-writable staging. Between check and use the bytes change.

Rollback, the silent hole

Signature validity is not freshness. A device that will boot any signed image will boot last year's signed image with last year's bugs — and the attacker does not need to forge anything, only to downgrade. Anti-rollback is a counter, and counters must live in hardware that only counts up: eFuse version fields burned per release, eMMC RPMB (Replay Protected Memory Block), the LowestSupportedFirmwareVersion UEFI variable, Android AVB's rollback_index in vbmeta. If the version comparison happens in rewritable storage, it is decoration — the attacker rewrites the floor along with the image. RPMB is the mechanism worth unpacking because it is the answer in miniature: a small keyed region inside the eMMC, typically 4 MB, whose writes carry an HMAC-SHA256 under a one-time-programmed key and a hardware write counter that only increments — replayed values fail the MAC, and the floor cannot move down.

BootHole's dbx update worked this way at the PC layer: the fix for CVE-2020-10713 was mass revocation, because 'signed and trusted' had to stop meaning 'bootable forever'. SBAT added generation metadata so revocation could move by generation rather than per-hash. Same principle, different substrate.

The wrong mental model

"We sign our updates, so the update path is safe." Signing proves authorship to whoever verifies the signature. It does not choose where verification runs, it does not protect the check-use interval, and it does not express 'newer than'. Each of those is a separate mechanism, and each is missing somewhere in shipping products right now.

What to actually do

Audit: find the verifier and the verify-use interval. Trace who checks the signature, whether that code is itself inside the signed payload, where the key lives (immutable vs. filesystem), and whether a downgrade to an old signed image is rejected — try it, since docs lie. Ship: verify in the earliest writable-immune stage you have (ROM/BL1/fused key), verify bytes then flash them without re-reading attacker-writable paths, bind anti-rollback to a hardware counter, and A/B with atomic commit so a failed flash is a reboot, not a brick. The update path will eventually run hostile input; design so that input fails closed.

Was this lesson helpful?

Sign in to rate

Keep reading

Related articles from the SudoSecurity blog.