Section 19.1.8

Chosen-message unforgeability and a MAC security game

Full name: Chosen-message unforgeability and a message authentication code (MAC) security game.

Definition

A MAC security game is a precisely stated contest that defines when a message authentication code §5.7 (MAC), an algorithm §14.1 that computes a short tag from a secret key and a message, is secure. A challenger holds a random key. The attacker obtains the tags of messages it chooses, then wins by presenting a valid tag for a message it never asked about. Chosen-message unforgeability is the property that every attacker with a feasible amount of computation wins only with negligible probability, meaning a probability too small to matter.

Where it fits

Main entry: Message authentication code (MAC) (§5.7).

The MAC entry states the game in full. In short:

  1. The challenger picks a key KK uniformly at random and keeps it secret.

  2. The attacker sends messages M1,M2,…M_1, M_2, \dots of its choice, each possibly depending on earlier answers, and receives the genuine tag Tag(K,Mi)\mathrm{Tag}(K, M_i) of each. These requests are called tagging queries.

  3. The attacker outputs a pair (M*,T*)(M^{*}, T^{*}) and wins if T*T^{*} is a valid tag for M*M^{*} and M*M^{*} differs from every MiM_i.

The full name of the property is existential unforgeability under chosen-message attack (EUF-CMA). Existential means that any new message counts, even a meaningless one, because the designer of a MAC cannot know which messages will matter to an application.

A definition without tagging queries would accept broken designs. Take 16-bit keys and messages and the tag T=K⊕MT = K \oplus M, where ⊕\oplus is bitwise XOR (exclusive or): each output bit is 1 exactly where the two input bits differ. To an attacker who has seen no tag, the tag of any message is uniformly random, so a guess is right with probability 2−162^{-16}. Now let K=𝟶𝚡𝟻𝙰𝟹𝙲K = \mathtt{0x5A3C}. The attacker asks for the tag of M1=𝟶𝚡𝟷𝟸𝟹𝟺M_1 = \mathtt{0x1234} and receives T1=𝟶𝚡𝟻𝙰𝟹𝙲⊕𝟶𝚡𝟷𝟸𝟹𝟺=𝟶𝚡𝟺𝟾𝟶𝟾T_1 = \mathtt{0x5A3C} \oplus \mathtt{0x1234} = \mathtt{0x4808}. Then T1⊕M1=𝟶𝚡𝟺𝟾𝟶𝟾⊕𝟶𝚡𝟷𝟸𝟹𝟺=𝟶𝚡𝟻𝙰𝟹𝙲T_1 \oplus M_1 = \mathtt{0x4808} \oplus \mathtt{0x1234} = \mathtt{0x5A3C} is the key, and the new message 𝟶𝚡𝙵𝙵𝙵𝙵\mathtt{0xFFFF} gets the valid tag 𝟶𝚡𝟻𝙰𝟹𝙲⊕𝟶𝚡𝙵𝙵𝙵𝙵=𝟶𝚡𝙰𝟻𝙲𝟹\mathtt{0x5A3C} \oplus \mathtt{0xFFFF} = \mathtt{0xA5C3}. The attacker wins the chosen-message game with a single query, so the game rejects this design.

Re-sending a received pair (Mi,Ti)(M_i, T_i) is not a win, because it proves nothing about the MAC. It is a replay attack §1.26, which the protocol must stop with a freshness check such as a counter. The MAC entry also gives the stricter strong unforgeability, which counts a new valid tag on an already queried message as a win.

Limits and common mistakes

Chosen-message unforgeability is a property of the MAC alone. It does not stop replay, does not tell which holder of a shared key made a tag, and does not stop a valid message from being accepted by the wrong receiver or for the wrong operation unless that context is inside the tagged bytes (authentication coverage §5.41).

The game assumes a uniformly random key that stays secret. A key leaked through a side channel §1.29, or produced by a weak random number generator, is outside the game.

Questions answered

Why allow the attacker to see valid tags?

The attacker is allowed to see valid tags because real attackers do, and a definition that ignored this would certify MACs that break after the first message. Every message protected by a MAC (message authentication code) travels with its valid tag over a channel the attacker can read, so an eavesdropper collects message–tag pairs for free. The attacker can often also steer what gets tagged: a sensor tags readings of a room the attacker can heat. The chosen-message game therefore gives the attacker tags on messages of its own choice and still requires that it cannot produce a valid tag for any other message. Letting the attacker choose covers the attacker who only watches too, since waiting for whatever is sent is one way of choosing.

A toy tag shows the danger: the bitwise exclusive or T=K⊕MT = K \oplus M of a key KK and a message MM. With no tag seen, forging is a blind guess, but one observed pair gives K=T⊕MK = T \oplus M and with it a valid tag for every message. Re-sending an observed pair does not count as a forgery; it is a replay, which the protocol must stop separately.

Related entries: Authentication coverage (§5.41), Replay attack (§1.26), Forgery probability (§5.13).