Definition
Rollback is the deliberate return of a device to an older version of its software, usually because a newer version failed. Anti-rollback, also called rollback protection, is a rule by which the device refuses to install or start any version below a minimum that it stores, so that an attacker cannot reinstall an old, genuinely signed version that has a known flaw. Rollback needs an older version to run and anti-rollback forbids older versions, so a design must state exactly which older versions remain allowed, and until when.
The idea
A device runs version 8 of its firmware, the software stored in its flash memory §6.6. Version 9 arrives and is installed on trial, meaning that it must show that it works before the device adopts it for good. Version 9 crashes every time it starts. The best the device can do is to go back to version 8, which it still holds and which worked. That return is a rollback, and providing it is the job of a recovery fallback §8.29.
Now change the story. Version 8 has a flaw that lets an attacker take control of the device, version 9 repairs the flaw, and the device has been running version 9 for a month. An attacker who kept a copy of version 8 sends it to the device. Version 8 carries the vendor’s genuine digital signature §5.14, so a signature check accepts it, and the flaw is open again. This is a rollback attack, one form of downgrade attack §1.27. Anti-rollback exists to refuse it.
In both stories the device is asked to start version 8 after version 9. The signature cannot tell the two requests apart: it shows that the vendor produced version 8, not that version 8 is still acceptable today. What tells them apart is a fact only the device can record, namely whether version 9 was ever confirmed as working. So the device keeps a minimum version in persistent storage and raises it at the moment it adopts the newer version for good. Before that moment the older version is a permitted fallback; after it, the older version is refused. A ratchet is a fair picture: it turns forward freely and cannot turn back. The picture stops at the timing. A ratchet locks at every click, whereas the minimum should lock only when the new version has proved itself, or the device loses its way back.
How it works
Anti-rollback has four parts, and a design must specify each of them.
A version inside the signed bytes. Every image, the complete program file that is installed as a unit, carries a version number. The number must lie inside the bytes that the digital signature covers. A number outside them, for example in an unsigned header, can be raised by an attacker on an old image without breaking its signature.
A stored floor. The device keeps a minimum acceptable version, called the floor here, in storage that survives restarts and that an attacker cannot lower. The Version high-water mark §8.27 entry explains how the floor is kept and advanced, and the Monotonic counter §8.28 entry explains which kinds of storage resist being set back.
An acceptance rule on every path. An image may be installed or started only if its signature verifies and its version is at least the floor. Every path that installs or starts code must apply this rule: the normal update, the bootloader §6.30 (the first program to run after reset, which chooses what to start), a recovery mode and any factory tool. One path that skips the rule undoes the protection.
A floor-advance rule. The design says when the floor rises and to which value. It never says when the floor falls, because a floor that the device’s own code can lower can also be lowered by an attacker who reaches that code.
The floor-advance rule is where rollback and anti-rollback meet. Three timings are in use.
Raise at installation. The floor rises to the new version as soon as the new image is written. If the new image then fails, the old image is below the floor, so the device has no image it may start and needs outside help, such as reprogramming over a cable or a return to the factory.
Raise at confirmation. The floor rises only when the new image has started and confirmed that it works, as in a commit-confirmed update §8.23. During the trial the old image stays permitted, so a failed trial falls back to it. The price is a window: until confirmation, anyone who can make the new image fail, or keep it from confirming, also gets the old image started. A short, bounded confirmation window §8.24 limits that exposure; it does not remove it.
Raise to the oldest kept image. The floor rises to the lowest version among the images the device keeps in a startable state, so every kept image can start and nothing older can.
Android Verified Boot, the boot-time verification used on Android devices, shows the second timing. Each image carries a number called its rollback index, and the device keeps a stored rollback index in tamper-evident storage. The device refuses an image whose index is below the stored one. Its documentation directs that, on devices that update Android through two slots, the stored index be updated only from a slot marked successful, meaning a slot whose new system has started and passed its checks, so a new system on trial does not yet raise it. For systems in which a return to a previous version must remain possible, the same documentation describes the third timing: the stored index is set to the largest value that still lets every bootable slot start.
Many schemes compare a separate security number instead of the release version. The vendor raises the security number only in a release that repairs a vulnerability; Android Verified Boot raises the rollback index in this way. Releases with the same security number may then replace each other in either direction, and only a version that predates a security repair is refused. Ordinary rollback stays available, while every version with a known, repaired flaw is still refused.
A vendor that wants a whole fleet back on old code after the floor has risen does not lower the floor. It rebuilds the old code with a new, higher version number and signs it. Devices accept this rebuild as an ordinary update, which is called rolling forward. The floor never moves down, and a legitimate revert needs no exception in the rule.
Worked example
A device has two slots. Slot A holds version 8, which is confirmed. Version 7 has a known flaw that version 8 repaired. The floor is 8, so the acceptable versions are 8 and above, and version 7 is refused because . Version 9 is written into slot B and started on trial, and the bootloader gives an image on trial three starts in which to confirm itself. Follow the floor under two timings.
Raise at confirmation.
During the trial the floor stays 8. Version 9 crashes at each of its three permitted trial starts, and the bootloader falls back to slot A. Version 8 passes, because . The rollback succeeds.
After the revert the floor is still 8, and the acceptable versions are still 8 and above. That set includes the failed version 9. If version 9 is offered again, a device that only compares versions installs it again, crashes three more times and reverts again. An attacker who kept a copy of version 9 can repeat this as often as the attacker likes, which is a denial of service §1.28. A design that wants to prevent this keeps a second number, the lowest version it will accept as a new candidate, and sets it to after the failed trial. Version 8 keeps starting, because starting is governed by the floor of 8, while only version 10 or above may be installed next.
If instead version 9 confirms itself, the floor rises to 9. Slot A still holds version 8 with a valid signature, but , so version 8 is now refused and slot A is no longer a fallback.
Raise at installation. The floor becomes 9 when version 9 is written. Version 9 crashes, and the bootloader checks slot A: , so version 8 is refused. Neither slot may start. The device stops in a recovery mode if it has one, and otherwise cannot run at all. The rule did refuse version 8, but it also refused the recovery that the second slot existed to provide.
A security number. Now let versions 8 and 9 both carry security number 3, because version 9 added features but repaired no vulnerability, and let version 7 carry security number 2. After version 9 is confirmed, the stored security floor is still 3. A revert to version 8 is accepted, because , and version 7 is refused, because .
Stated precisely
Let be the stored floor, a whole number, and let be the version written inside the signed bytes of an image . Let be true when the signature of verifies under a key the device currently trusts. The device installs or starts only if When an image is adopted for good, the device sets to , the larger of the two numbers, and no step ever sets to a smaller value. At any moment the acceptable versions are exactly the versions with .
Anti-rollback guarantee: no image whose version is below is installed or started. It holds under four assumptions.
Nothing within the threat model §1.2, the written account of what an attacker and the environment can do, can lower the stored . If physical reprogramming of storage, or restoring an earlier copy of it, is in the threat model, the storage must resist that too.
The version is inside the signed bytes.
Every path that installs or starts code applies the rule.
Versions are compared under one fixed ordering: as unsigned numbers of a fixed width that never wrap around, or as tuples compared one component at a time from the most significant component.
Rollback guarantee: let be the image that ran, confirmed, immediately before a new image was put on trial. A failed trial of can fall back to only if at the moment of the fallback. If is raised only when an image is adopted for good, holds throughout the trial: passed the rule, so then; adopting raised to at most ; and does not change while is on trial. If is raised to at installation and , the condition fails. The two wishes, that the old image is refused from the moment the new one is installed and that the old image remains a fallback until the new one is confirmed, cannot both hold; a design must give up one of them.
Limits and common mistakes
A digital signature alone gives no anti-rollback. It proves who produced an image, not whether that image is still acceptable. Old images keep valid signatures for as long as their signing key is trusted.
Anti-rollback is only as strong as the storage that holds the floor. A floor kept in ordinary flash memory can be set back by anyone who can rewrite or restore that flash.
A rule of the form “accept anything newer than the version now running” is not anti-rollback. After a revert the running version is the old one, so the rule accepts the failed newer candidate again. A rule of the form “accept only versions at least as new as the version now running” fails the other way: while version 9 is on trial, it refuses version 8, the fallback.
Anti-rollback for code does not protect stored data. An older settings file, an older list of trusted keys or an older policy file can be restored or replayed just as an old image can. Each kind of stored object that must not go backwards needs its own version and floor.
After a signing key is withdrawn by key revocation §5.32, old images signed with that key should be refused by the key check whatever their version. The version floor and the list of trusted keys are two separate rules, and each covers cases the other misses.
The word rollback has a second meaning. In databases, rolling back a transaction §8.7 undoes its unfinished changes, so that the data returns to its state before the transaction began. That operation is part of atomicity §8.3 and has nothing to do with software versions.
Questions answered
Which versions remain acceptable after a legitimate revert?
After a legitimate revert, the acceptable versions are those at or above the stored floor, the minimum version that the device keeps in protected storage, and a correct design has not raised that floor above the version it reverted to. A legitimate revert is a return to an older version that the device’s own rules permit, typically because a new version failed during its trial. If the floor rises only when a new version is confirmed as working, a failed trial never raised it. In the usual case, where version 8 was running and version 9 failed its trial, the floor is still 8: version 8 and every newer signed version remain acceptable, and every version below 8 stays refused.
Two points need an explicit decision. First, the failed candidate, version 9, is still at or above the floor, so a device that compares only versions will install it again if it is offered; a design that must refuse it keeps a separate minimum for new candidates and sets it above the failed version. Second, if the floor had already been raised to 9 before the revert, the revert itself broke the rule. The fix is not to lower the floor, since a floor that the device’s own code can lower can also be lowered by an attacker who reaches that code. A vendor that wants old code back rebuilds it under a higher version number and ships it as an ordinary update.
Related entries: Version high-water mark (§8.27), Monotonic counter (§8.28), Commit-confirmed update (§8.23), Secure boot (§6.31), Downgrade attack (§1.27), Recovery and anti-rollback can conflict (§17.11), Recovery fallback (§8.29), A/B update (§8.10).