Safeguard
Security Guides•

How does MCUboot stop a downgrade to an older, vulnerable firmware?

MCUboot has test swaps that revert, version checks in overwrite mode, and a hardware security counter. What each stops and where each falls short.

Safeguard Security Team
3 min read

MCUboot has three related mechanisms. Test swaps revert a new image that never confirms itself, version comparison blocks downgrades in overwrite-only mode, and a hardware security counter stored on the device rejects images below a set value. Only the counter is designed to resist deliberate rollback.

Two different problems

People often use the word rollback for two things.

  • Recovery. A new image is bad, so the device should return to the old one. This is about reliability.
  • Downgrade attack. An attacker installs an old, validly signed image that has a known vulnerability. This is about security.

MCUboot's options map to these differently.

The mechanisms

Test and permanent swaps. In swap mode a test swap boots the new image. If the image does not confirm itself, the next reset reverts to the old one. A permanent swap cannot be reverted. This is recovery, not attack defense.

Software downgrade prevention. The MCUBOOT_DOWNGRADE_PREVENTION option compares image version numbers. The documentation says it is only available with the overwrite-only strategy.

Hardware rollback protection. With MCUBOOT_HW_ROLLBACK_PROT, the signed image carries a security counter in its protected TLV area, added with imgtool's -s option. The bootloader compares it with a value kept in non-volatile, trusted device storage that your target provides. The counter is independent of the version number. An image with the same counter value is accepted, so some software downgrades remain possible.

MechanismHelps with bad updatesHelps with downgrade attacks
Test swap with revertYesNo
Version comparison, overwrite-onlyPartlyLimited by mode
Security counter in trusted storageNoYes

Using the counter well

  1. Keep the counter separate from the marketing version.
  2. Raise it only when an image fixes a security problem you cannot allow to return.
  3. Increase the stored value after the new image proves it boots, so a failed update cannot lock the device out of its only working image.
  4. Document who may approve a counter bump, because it cannot be undone.

Test it

Write a test that installs an older signed image with a lower counter and confirm it is rejected. Do the same with an image that has an equal counter, and decide whether that behavior is acceptable for your product.

Where Safeguard fits

Safeguard supports compliance and evidence automation alongside SBOM and dependency scanning, so a record like this can be kept with your other evidence. Try the free scan at gold.safeguard.sh/scan on a repository you already own.

Quick check

Does a signed image mean rollback is impossible?

No. An old image that was legitimately signed will still verify unless something, such as a counter in trusted storage, rejects it.

Where is the security counter kept?

In non-volatile, trusted device storage that the target supplies to the bootloader.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.