The hard part of a remote update is not downloading the file. It is what the device runs on the next boot if the download stops halfway. A half-written file placed on top of the running copy corrupts the boot path as well. From then on the device can find neither the new software nor the old one.
RFC 9019 defines a firmware update architecture for Internet of Things devices. In that architecture the device checks the downloaded bytes against a manifest. The manifest carries the image identity, an integrity value, and the conditions under which it may be installed. If the integrity check fails, installation does not start. That check replaces the sequence "the file arrived, write it".
The practical layout has two slots. The new image is written to the slot that is not running. When the write finishes, integrity is checked. If the check passes, the boot flag moves to the new slot and the device restarts. If the new software does not report itself healthy within a set time, the flag returns to the old slot. If power fails in the middle of the write, the running slot is still there.
NIST IR 8259A lists software update among the core cybersecurity capabilities of an IoT device. The name of the capability does not mean the update survives being cut off. That property comes from the slot layout and the rollback rule.
Before writing update code for a field device, FenergyTech fixes two points: a partial image will not be selected at boot, and the old image returns if the new one does not confirm itself.
The test is done by cutting power on purpose. The supply is pulled when 30 percent of the image has been written. Boot has to come from the old slot. If 100 percent is written, the integrity check has passed, and power is cut before "I am healthy", boot returns to the old slot again. If the second case is not written down, a new image that sticks on first boot can never come back to the old one.
The manifest in RFC 9019 carries the digest of the image and which hardware it may be installed on. If the digest does not match, the write does not start. If the manifest carries another product's image, the hardware identity rejects it even when the digest matches. Without an identity, the wrong image can have the right digest. The identity therefore stands in addition to the digest.
The confirm window is bounded by time as well. The time is longer than the device needs to boot and do one pass of work in the field, and short enough not to lock the next shift. If the time is not written, and "I am healthy" never arrives, the device stays on the old slot and nobody reads that as a fault. The log says which slot was chosen, and why.
Sources: RFC 9019, A Firmware Update Architecture for Internet of Things, IETF, 2021. NIST IR 8259A, IoT Device Cybersecurity Capability Core Baseline, 2020.
Planning a similar project?
We can talk through how the topic in this article applies to your product.