Definition
Adversarial composition is the analysis of a system under attacks that combine several attacker actions, or that set several of the system’s mechanisms against one another, instead of testing one capability or one mechanism at a time. Each mechanism is secure only while its assumptions hold, and an attacker can use one action to break an assumption that another mechanism relies on. Mechanisms that are each secure in isolation therefore need not form a secure system. The analysis checks that every assumption still holds in every combined sequence of events.
The idea
A device accepts commands that carry a message authentication code §5.7 (MAC), a short tag that only a holder of a secret key can compute, and a counter that must exceed the counter of the last accepted command. Tested alone, each mechanism works: a forged command fails the MAC check, and a recorded command sent again fails the counter check. Now the attacker records a valid command, cuts the device’s power, and sends the recording again after the restart. If the last accepted counter was kept only in RAM, the restart set it back to 0, and the old command is accepted. Neither mechanism failed. The counter check assumed that its stored value never decreases; the reset, a third event that the attacker controls, broke that assumption.
The pattern is not limited to small devices. Encryption hides the content of a message but not its length, and compression makes the length depend on the content. The CRIME attack (Compression Ratio Info-leak Made Easy), published in 2012 [414], combined the two in TLS (Transport Layer Security), the protocol that protects web traffic. A request often carries a secret cookie, a value the browser sends to prove that the user is logged in. An attacker who could add chosen text to such a request, and could see the length of the encrypted request on the network, learned the cookie one character at a time: a guess that matched part of the secret compressed better and produced a shorter encrypted request. Each mechanism did its own job; the combination leaked the secret.
How it works
The analysis proceeds in four steps.
List each mechanism with its guarantee and its assumptions. A MAC check guarantees that an accepted command came from a key holder, assuming the key is secret. A counter check guarantees that each command is accepted at most once, assuming the stored counter never decreases. A validator, a check that a program is well formed and stays within its limits, guarantees that an accepted program cannot leave its memory region, assuming the validator runs on every program.
For each assumption, find what supplies it: another mechanism, or a stated property of the environment. Write the chain down. An assumption that nothing supplies is a gap.
List the events the attacker can cause or wait for: replay of recorded messages, a reset or power loss at any instant, delay and reordering, concurrent requests, key changes §5.29, recovery and fallback modes, and malformed input from a party that holds a valid key. Look hardest at state that one mechanism writes and another reads, and at events that clear or restore state.
Build combined sequences of those events and check the security property along each one, step by step. A security invariant §1.23 over the whole system state, with the attacker’s actions among the transitions, is the systematic form of this step.
Composition can also change authority over time. A key change that leaves the old key valid during a transition period, a recovery mode that accepts an older version, and a reset that restores an older counter each reopen something that another mechanism had closed. A replay attack §1.26, which sends a recorded genuine message again, or a downgrade attack §1.27, which makes a system fall back to an older or weaker version, needs only such a window. A window like this is acceptable only if it is limited in time and the security claims state explicitly that they do not cover it.
Worked example
A device runs small programs that arrive over the radio. Each update message carries a counter value, a program and a MAC over both. The device accepts a message if the MAC is valid and the counter is greater than , the counter of the last accepted message, which the device keeps in RAM. The device has a validator, which checks that every jump in a program lands inside the program, but the loader skips it for authenticated programs to save time. Program 18 is 512 bytes long and contains one jump to offset 700; its last byte is at offset 511, so the jump lands bytes past its end; that jump runs only when an input byte equals 0xFF. The vendor fixed the mistake in program 19.
The device accepts message 18: the MAC is valid and . It sets . The attacker records the message from the air.
The device accepts message 19: the MAC is valid and . It sets and runs program 19.
The attacker cuts the power for a moment. The device restarts, RAM is cleared so that , and program 19 starts again from flash.
The attacker sends the recorded message 18. Its MAC is valid, because the vendor really did compute it, and . The loader skips validation because the message is authenticated, and installs program 18.
The attacker sends an input byte
0xFF. Program 18 jumps 189 bytes past its own end, into memory that holds other data, and the device runs whatever bytes lie there.
Every check behaved as designed: the MAC was genuine, the comparison is true, and skipping validation for authenticated programs was the documented rule. The combination failed because the counter check assumed a stored value that never decreases, which RAM does not provide across a reset, and the loader assumed that authenticated means well formed, which nothing provides.
The repair supplies each assumption. The device keeps in flash as a monotonic counter §8.28, a stored value that the code only ever increases; in step 4 it then compares 18 with 19 and refuses. The validator runs on every program, authenticated or not, so a program like 18 is refused even when it arrives fresh, for example after being signed by mistake. The moment of the counter write matters as well. If the device installs the program and writes afterwards, a reset between the two writes leaves program 19 running with stored, and message 19 can be accepted a second time. If the device writes first, a reset between the two writes leaves stored while program 18 still runs, and the genuine message 19 is now refused. The design must state which outcome it accepts, or make the two writes a single atomic step.
Stated precisely
Describe each mechanism by an assumption and a guarantee : in every execution in which holds, holds. Let be the stated assumptions about the environment, including what the attacker can do. The mechanisms together provide a system property when, along every sequence of events that the attacker can cause, two conditions hold.
Each follows from together with the guarantees of the other mechanisms.
together with all the guarantees implies .
This style of argument is called assume-guarantee reasoning §1.36. The chain of support must not be circular in a way that proves nothing: if is supplied by and by , the argument holds only if an induction over time shows that neither guarantee can be the first to fail.
In the example, the MAC guarantee needs a secret key, which the environment supplies. The counter guarantee needs a stored value that never decreases; includes resets, and a counter kept in RAM does not survive them, so the assumption is unsupplied. The validator’s guarantee needs the validator to run on every program; skipping it for authenticated programs replaces that assumption with “every key holder produces only well-formed programs”, which nothing supplies.
Limits and common mistakes
No analysis can list every imaginable combination: the number of event sequences grows exponentially with their length, a problem called state explosion §3.26. Model checking §3.30, which explores every sequence of a finite model automatically, helps for small models. By hand, derive combinations systematically from shared state, changes of authority, failures and timing, and state which combinations the analysis covers.
Repairing one check does not restore a lost assumption. Changing the comparison from greater-than to greater-or-equal does not bring back a counter that a reset erased. The repair must supply the assumption itself: a counter that survives resets and never decreases, or a fresh challenge per message, a random value that the receiver issues and the sender must include.
Authentication §1.6 limits who can send, not what they send. A legitimate key holder, a stolen key or a build mistake can produce authenticated messages that are malformed or harmful, so validation and resource limits must apply to authenticated input too.
The attacker can often cause the failures that designers treat as accidents: a reset by cutting power or lowering the supply voltage, a timeout §9.34 by delaying messages, a recovery mode by corrupting a stored record. The analysis must treat these failures as attacker actions.
Proofs about isolated parts do not compose automatically. In cryptography, the universal composability framework, introduced by Ran Canetti in 2001 [415], defines security so that a protocol proved secure stays secure when it runs alongside arbitrary other protocols. A protocol proved secure only in isolation carries no such promise.
Questions answered
What happens if replay, reset, and malformed authenticated code occur together?
If replay, reset and malformed authenticated code occur together, a device that keeps its replay counter only in RAM and trusts authenticated code accepts an old recorded message after the reset and runs its malformed program, although every individual check behaves as designed. Replay means sending a recorded genuine message again; malformed authenticated code is a program that carries a valid message authentication code (MAC) but violates the rules for safe programs. The sequence is: the device accepts message 18 and later message 19; a reset clears the RAM counter to 0; the recorded message 18 passes both the MAC check (it is genuine) and the counter check (); the loader skips validation because the message is authenticated; the old program then runs its out-of-bounds jump.
Each mechanism’s assumption was broken by another event. The counter check assumed a stored value that never decreases, and the reset removed it. The loader assumed that authenticated means well formed, and the malformed program showed that it does not. The repair supplies each assumption: a counter kept in non-volatile storage, which keeps its content without power, that only ever increases, written no later than the program is installed, together with any minimum-version rule that recovery must respect; validation of every program, authenticated or not; and an analysis of a reset at every point of the update sequence. With these in place, the replay fails at the counter check because 18 is not greater than the stored 19, and a freshly signed malformed program is still refused by the validator.
Related entries: Replay attack (§1.26), Downgrade attack (§1.27), Key rotation (§5.29), Failure atomicity (§8.5), Assumption versus guarantee (§1.36), Monotonic counter (§8.28), Lifecycle reset and replay across complete reinitialization (§19.3.7). Further reading: [414, 415].