Section 1.27

Downgrade attack

Definition

A downgrade attack is an attack that makes a system use an older or weaker option than its policy requires: an older software version with a known flaw, a weaker cryptographic algorithm §14.1, a shorter key or a less protected mode. The attacker usually forges nothing. Instead, the attacker supplies a genuine old item whose signature is still valid, or tampers with the unprotected step in which two parties choose among the options they support. The defenses are a version floor, the lowest version a device accepts, and authenticating the negotiation.

The idea

A device accepts any firmware, the software stored in the device, that carries a valid digital signature §5.14 from its maker. Version 7 had a flaw that let an attacker take over the device, and version 8 fixed it. The signature on version 7 is still valid: a signature shows who made a file and that it is unchanged, and nothing about it changes when a newer file appears. An attacker who kept a copy of version 7 installs it, the device accepts it, and the old flaw is back.

The second form attacks a choice. Two parties that both support a strong and a weak algorithm send each other lists of what they support and pick the best entry on both lists. If the lists travel unprotected, an attacker in the middle deletes the strong entries, and both parties settle on the weak one, each believing the other could do no better. The Logjam attack on TLS (Transport Layer Security), the protocol that protects web traffic, published in 2015 [348], worked this way against servers that still supported a deliberately weakened 512-bit key agreement, the step in which two parties compute a shared secret key, left over from 1990s United States export rules.

In both forms the attacker cannot make the system do something it refuses, so the attacker steers it to an option it still accepts. A ratchet is a fair picture of the defense: it lets the version move up and stops it moving down. The picture stops being accurate in one respect: a mechanical ratchet holds by itself, while a version floor holds only as long as nobody can reset the memory that stores it.

How it works

Against version rollback, the device keeps a version floor, often recorded as a version high-water mark §8.27, the highest version it has confirmed.

  1. The maker puts the version number, and the product the file is for, inside the signed bytes, so that neither can change without breaking the signature.

  2. The device verifies the signature, checks that the product is itself, and compares the file’s version vv with its floor FF. It refuses the file if v<Fv < F.

  3. The device raises FF only after a new version has been installed and confirmed working. Raising FF earlier would forbid falling back to the previous version if the new one fails to start.

  4. FF lives in storage that the update, reset, recovery and restore paths cannot decrease, such as one-time programmable fuses, bits that can be set once and never cleared, or a monotonic counter §8.28, a hardware counter that can only increase.

  5. The device makes the check on every path that installs or starts code: the start-up path as well as the update path.

Many designs keep a separate security version number that increases only when a release fixes a vulnerability. Ordinary releases may then replace each other in either direction, and the floor blocks only versions with a known flaw.

Against negotiation downgrade, both parties authenticate the record of the negotiation, called the transcript. At the end of the handshake, the exchange that sets up the connection, each side computes a MAC (message authentication code §5.7) over every handshake message it sent and received, with a key from the key agreement just made, and the two sides compare the results. If the attacker deleted an option, the two transcripts differ and the connection stops. TLS does this in the handshake messages it calls Finished. The strongest defense is simpler: stop offering the weak option.

Worked example

Let the floor be F=8F = 8. Three correctly signed files arrive, all for the right product.

Now let the device store FF in ordinary flash memory §6.6, and let a factory reset rewrite that memory with its factory content, in which F=6F = 6. After a reset, version 7 passes 7≥67 \ge 6. The signature check and the comparison both work correctly, and the downgrade succeeds, because the reset lowered the floor.

For negotiation, a client offers versions 1.3, 1.2 and 1.0 of a protocol, and the server, which supports all three, would pick 1.3. An attacker deletes 1.3 and 1.2 from the offer, so the server picks 1.0. At the end of the handshake the client’s MAC covers the offer 1.3, 1.2, 1.0 and the server’s MAC covers the offer 1.0; the results differ and the connection stops. If the key agreement of version 1.0 is weak enough to break during the handshake, however, the attacker obtains the MAC key and computes the result each side expects, and neither side notices. Removing version 1.0 is the real repair.

Stated precisely

Version floor. Let vv be the version of a candidate file, pp the product it names, FF the floor the device stores and dd the device’s own product identifier. The device admits the file only if the signature verifies over bytes that include vv and pp, p=dp = d, and v≥Fv \ge F; a design that forbids reinstalling the current version uses v>Fv > F. FF changes only by F:=max(F,v)F := \max(F, v) when version vv is confirmed. Then no version below FF is installed or started, provided four assumptions hold.

  1. No attacker holds a signing key.

  2. Every path that installs or starts code makes the check; this is complete mediation §1.16, checking every access.

  3. Nothing in the threat model §1.2, including reset, recovery, restore from a backup and physical rewriting of storage, can make the stored FF smaller.

  4. All versions are compared under one fixed order.

Negotiation. Both parties detect any change to the offered or chosen options, provided the transcript is authenticated with a key that the attacker cannot obtain before the check completes. That holds only if every option that either party will accept resists the attacker for the length of the handshake.

Limits and common mistakes

A floor orders versions; it does not make a newer version safe. Version 9 can contain a new flaw, and the floor then forbids returning to version 8 even if version 8 was safer.

Versions need one agreed order. Compared as text, character by character, 1.10 comes before 1.9; compared part by part as numbers, 1.10 comes after 1.9.

A version number means nothing without the product it belongs to. Version 8 of one product is not newer than version 7 of another, and a floor checked without the product identifier admits a genuine file made for a different product.

Each fuse can be programmed only once, so a floor kept in fuses can rise only as many times as there are fuses. This is one reason to raise such a floor only for security fixes.

A stolen signing key defeats the floor: the thief signs old, flawed code under a high version number.

Cryptographic agility §5.40, the ability to change algorithms without redesigning a protocol, is what makes negotiation necessary, and negotiation is what downgrade by negotiation attacks. Every option kept for compatibility is an option an attacker can steer toward.

Questions answered

Can recovery or rollback lower the version floor?

In a correct design, no: recovery and rollback must leave the version floor, the lowest software version the device will install or start, where it is. Rollback here means returning to the previous version after a failed update. It is allowed only to versions at or above the floor, which is why the floor should rise only after a new version is confirmed working, not when it is first installed.

Recovery paths, such as a factory reset, a recovery mode, restoring a backup or rewriting the storage chip, are where floors are lost in practice, because they overwrite ordinary memory. With a lower floor, a genuine old version with a known flaw passes both the signature check and the version check. The floor must therefore live where none of these paths can decrease it, such as one-time programmable fuses or a hardware counter that can only increase, and every path that installs or starts code must check it. If the owner must be able to lower the floor, give that power to one named recovery authority §1.46, a party allowed to override the normal rules, such as the holder of a recovery key §5.31 kept offline, and state in the security claim that this party can downgrade the device.

Related entries: Replay attack (§1.26), Cryptographic agility (§5.40), Recovery key (§5.31), Rollback versus anti-rollback (§8.26), Version high-water mark (§8.27), Monotonic counter (§8.28), Protocol downgrade, negotiation, and authenticated capabilities (§19.5.8), Recovery authority (§1.46). Further reading: [348].