Setting
A sensor gateway is a small device that collects readings from sensors and passes them on. In this invented example, the gateway also runs a small decision program, and a publisher, the one party authorized to change the gateway’s policy, sends it new programs and management requests. Everything travels through a phone that relays the bytes over a Bluetooth radio link. Each request carries a tag computed with HMAC §5.8 (hash-based message authentication code), a message authentication code §5.7 (MAC): a function that computes a short value, the tag, from a secret key and a message, so that someone without the key should have only a negligible chance of creating a valid tag for a new request.
The gateway runs the publisher’s decision program in a virtual machine §2.3 (VM), a part of its software that carries out the program’s instructions one at a time and refuses any instruction that would touch memory outside the program’s own. The program decides which management requests the gateway allows.
The gateway holds two secret keys. is the active key, the key whose tags the gateway accepts on ordinary requests; it belongs to generation number , where the generation number counts key replacements. is the recovery key §5.31: a separate key, kept offline at the publisher, whose tags authorize one recovery action, installing a new active key. The publisher computes both keys from a root secret with a key derivation function §5.20 (KDF), an algorithm §14.1 that turns one secret and a public label into a key: and .
After a compromise, damage spreads along two kinds of link. A derivation link runs from a secret to every key computed from it: whoever knows can compute . An authority link runs from a key to every key it can install or revoke: whoever holds can make the gateway accept a new active key. An attacker reaches every key along either kind of link.
Short answer
A compromise gives the attacker every key derivable from the stolen secret and every power the stolen key carries, including the power to install other keys. A stolen active key lets the attacker make any request may authorize, until the gateway stops accepting . A stolen recovery key is worse: it can replace whatever active key exists. A stolen root secret exposes every key derived from it. Recovery needs trust the attacker cannot reach, such as an independent key or physical access to the gateway.
Follow-up questions
Active-key compromise
An attacker who holds the active key can make every request that may authorize, until the gateway stops accepting . Here a sensor gateway accepts its publisher’s requests when they carry a tag computed with by HMAC (hash-based message authentication code), a message authentication code (MAC) that only a holder of the key can compute. HMAC shows that the sender knew ; it cannot tell the publisher from a second holder. Because is shared by both ends, the attacker can also pose as the gateway toward the publisher, if the gateway’s replies are tagged with .
What the attacker can do depends on what authorizes:
Install decision programs. A program the attacker tags still runs inside the gateway’s virtual machine (VM), which refuses any instruction that would touch memory outside the program’s own. The attacker therefore cannot use the program to take over the gateway’s software. The program still decides requests, though: it can deny every request, or allow the attacker’s own.
Change keys. If may authorize a key change §5.29, the attacker can install a key of its own choosing and lock the publisher out. The publisher must complete a key change before the attacker does, to a new key delivered under protection that does not depend on , and the gateway must then stop accepting .
alone does not reveal the content of past messages, because a MAC key authenticates and does not encrypt. That changes if was also used to encrypt something, for example a replacement key wrapped under : an attacker who recorded that transfer learns the replacement key as well.
Recovery-key compromise
An attacker who holds the recovery key can replace the gateway’s active key with a key of its own, without ever learning the current active key . The recovery key is a separate secret. A request that carries a tag computed with by a message authentication code (MAC), a short check value that only a holder of can compute, may install a new active key. Example: the attacker chooses a key and sends “recovery: install as generation 9”, tagged with . The gateway checks the tag and accepts the request, and from then on accepts only tags made with . The publisher’s is now useless.
No cryptography was broken. The MAC that produced the tag remains secure; the attacker simply used a power that the design granted to . Such a power is an authority link: holding one key lets its holder install or revoke another.
Replacing the active key does not close that link, because the attacker can repeat the recovery and replace the new active key as well. The repair must replace itself, through trust the attacker does not hold: for example a higher-level key, kept offline, that may replace , or physical access to the gateway, such as a button press or a wired connection. Every gateway that accepts must learn the new rule, including gateways that are switched off when the repair begins.
Root compromise
If a root secret is exposed, every key derived from with public inputs is exposed too, including keys that have not been derived yet. A key derivation function (KDF) computes a key from a secret and a label. Suppose a sensor gateway’s active key is and its recovery key, which may install a new active key, is , with public labels. An attacker who learns computes both. It can also compute , so a key change that derives the next key from hands the attacker the next key at the same moment. A new label adds no secrecy, because labels are public.
Follow both kinds of link to their end. From , derivation links reach every key computed from . From each of those keys, authority links reach every key that it may install or revoke. Here is computed from , so the attacker also holds the power to replace any active key the publisher installs later.
Recovery needs fresh secret material that the attacker never saw, produced by a random source the attacker cannot observe, and installed through a path the attacker can neither control nor replace with its own. While the attacker holds , it can substitute its own “fresh” key for the publisher’s. When every authority in the design traces back to , no message to the gateway can restore trust. Only an action outside the compromised keys can, such as an operator with physical access setting the gateway up again with a new root.
Does a new independent active key provide forward secrecy §5.33?
No: an independent new key can protect future messages, forward secrecy is about past ones, and neither property follows from independence alone. A key is independent of another key when it was made from fresh randomness, so that knowing one tells nothing about the other.
Forward secrecy is a property of a protocol: an attacker who later learns the long-term keys §7.28 still cannot recover the keys of sessions that ended before. A protocol obtains it by agreeing a fresh key for each session, for example by Diffie–Hellman key agreement §19.1.4 with new private values, and by erasing those values afterwards. Post-compromise security §5.34 points the other way in time: after an attacker has learned a party’s secrets, security returns for later messages once the parties complete an exchange that the attacker neither observes nor controls. The Double Ratchet algorithm of the Signal messaging protocol obtains it by mixing new Diffie–Hellman values into its keys as messages flow.
Apply this to a sensor gateway whose active key authenticates requests with a message authentication code (MAC) and is replaced by a new key :
and authenticate; they encrypt nothing. Forward secrecy concerns the secrecy of past messages, so the matching question for them is different: can someone who steals a key later make tags that pass as earlier messages? Generating independently does not answer that question. The answer depends on whether the old key was erased everywhere and whether the gateway still accepts tags made with it.
If was sent wrapped under , an attacker who held and recorded the transfer has too, however independently was generated. Nothing has recovered.
If was generated independently, delivered in a form the attacker could not read, installed by an authority the attacker does not hold, and was then revoked, later requests are protected again. That is recovery after compromise, and it comes from the delivery and installation path, not from independence alone.
What must an operational recovery plan specify?
An operational recovery plan must say, before any compromise happens, how a compromise is detected, how far it reaches, which trust survives it, and how every affected device is brought back under that trust. For a fleet of sensor gateways whose requests are authenticated by a message authentication code (MAC) under an active key, with a separate recovery key that may install a new active key, the plan specifies:
Detection. The evidence that starts the plan, such as a key found published, a gateway reporting a key change nobody ordered, or requests the publisher never sent.
Scope. The keys, roles and devices affected: everything reachable from the stolen key along derivation links, to keys computed from it, and along authority links, to keys it can install or revoke.
Surviving trust. The key, channel or physical access that the attacker does not control, from which recovery starts.
Replacement and revocation. The order of the steps, and how each device learns its new keys and stops accepting the old ones.
Offline devices. A gateway that was switched off still accepts the stolen key when it returns, and the attacker may reach it first. The plan states how such a device is treated, for example as untrusted until its state has been checked.
Failed steps. What happens when a device loses power or contact in the middle of a key change.
Audit. A record of what was done to which device and when, kept where the attacker cannot alter it.
Safe refusal. The requests each device rejects while its state is uncertain.
If every relevant authority is compromised, the plan must name the trust to be set up again from outside, for example an operator installing new keys over a wired connection. Another exchange of tagged messages under a key the attacker holds cannot establish trust, because the attacker can compute the same tags.
Related entries: Recovery key (§5.31), Forward secrecy (§5.33), Post-compromise security (§5.34), Recovery authority (§1.46), Key derivation function (KDF) (§5.20), Key revocation (§5.32), TUF: surviving limited signing-key compromise (§21.10).