Definition
Authentication coverage is the exact sequence of bytes over which a message authentication code §5.7 (MAC) or a digital signature §5.14 is computed and checked. Only those bytes are protected: changing any covered byte makes verification fail, while a field outside the coverage can be changed by an attacker and verification still succeeds. Coverage is complete when it includes every field that affects what the receiver does or how it reads the message, encoded so that two different messages never give the same bytes.
The idea
A device receives commands made of a header and a body. The header names the target device and the operation; the body carries data. The sender computes an HMAC §5.8 (hash-based message authentication code) tag, a short value that only a key holder can compute, over the body alone. A relay that forwards the message changes the header: it replaces the target with another device that shares the key, and the operation “read status” with “erase”. The body and its tag are untouched, so the tag verifies, and the receiver performs an operation that no key holder requested. The cryptography worked; the tag simply never said anything about the header.
A signed contract is a fair picture. A signature at the foot of page 3 protects page 3. It says nothing about a page 4 that someone staples on later, or about a cover sheet that names the parties. What a receiver may rely on is exactly what the signature covers. So two questions apply to every field: do the authenticated bytes include this field, and does the receiver act on the same bytes it verified?
How it works
List the fields that matter. Write down every field the receiver uses to decide anything: the protocol and message type, the code naming the operation (the opcode), the target device, the sender’s role, the version of the format, every length, the mode or options, the payload, and the freshness value, such as a counter, that lets the receiver reject an old message sent again.
Add a domain label §5.22. Put a fixed string that names this kind of message, such as
cmd-v1, at the start of the authenticated bytes, so that a tag made for one purpose is never valid for another. This is domain separation.Encode without ambiguity. Turn the fields into one byte string with an encoding that gives different bytes for different field values: fixed-width fields, or a length in front of each variable-length field. Joining variable-length fields without lengths fails: the field pairs (
1,23) and (12,3) both become123. The serialization §4.28 entry treats this in full.Compute the tag over the whole string.
Verify, then use the same bytes. The receiver recomputes the tag over the exact bytes it received and compares it with the received tag using a constant-time comparison §4.33. Only then does it parse those same bytes and act on the fields parsed from them. It never takes a field from a different buffer, an outer header or a second copy.
Cover context that the receiver already knows. A field both sides know need not be sent, yet it can still be covered. The sender includes, for example, the receiver’s device identifier in the authenticated bytes, and the receiver inserts its own identifier when it recomputes the tag. A message meant for another device then fails verification.
The same idea appears under other names. In AEAD §5.16 (authenticated encryption with associated data), the associated data is the part of the coverage that is authenticated but sent unencrypted, typically a header. RFC 9421, HTTP Message Signatures [351], calls the parts of an HTTP (Hypertext Transfer Protocol) message that a signature protects its covered components.
Worked example
A command message has this layout:
version, 1 byte:
0x01;device identifier, 4 bytes:
0x0000002A, device 42;operation, 1 byte:
0x03, read status;length, 2 bytes:
0x0010, which is 16;payload: 16 bytes;
tag: 32 bytes of HMAC-SHA-256 §5.9, the HMAC built on SHA-256 §5.2 (Secure Hash Algorithm with a 256-bit output).
The header is bytes, and the whole message is bytes.
Coverage of the payload only. The tag covers 16 of the 56 bytes. An attacker changes the device identifier to 0x0000002B, device 43, and the operation to 0x07, which in this protocol means erase. The 16 covered bytes are unchanged, so the tag still verifies. All 8 header bytes lie outside the coverage, and no tag length can repair that: even a full 32-byte tag says nothing about bytes it was not computed over.
Full coverage. The tag is computed over the 6-byte label cmd-v1, then the 8 header bytes, then the 16 payload bytes: bytes. The label is not sent, because both sides know it. Changing any of the 24 sent bytes before the tag now changes the input to HMAC, so the attacker needs a new valid tag, and a guess without the key is right with probability . The layout still has no counter, so a recorded message can be sent again; a 4-byte counter in the covered header lets a receiver that stores the last accepted counter reject the copy.
Stated precisely
Let the receiver’s action depend on fields . Let be the encoding that turns a domain label and these fields into the authenticated byte string , and write for the MAC of under key . Coverage is complete when three conditions hold.
Every relevant field is covered: each field on which the action or the parser depends is either an argument of or taken from the receiver’s own trusted state.
The encoding is injective: different arguments give different byte strings, that is, only if .
Same bytes: the fields acted on are parsed from exactly the bytes that were verified.
If the three conditions hold and the MAC is unforgeable by anyone without , an attacker without who changes any field the action depends on must produce a valid tag for a new string . For a -bit tag, one guess succeeds with probability about . If condition 1 fails for a field , changing leaves unchanged, and no tag, however long, detects the change.
Limits and common mistakes
Coverage is not freshness. A fully covered message can be recorded and sent again. The receiver detects the copy only if a counter or a challenge value is covered and checked against stored state; otherwise a replay attack §1.26 succeeds.
Coverage is not authorization §1.7, and it hides nothing. A covered, genuine command from a key holder may still be one the receiver must refuse, and a MAC gives no confidentiality §1.8.
Checking one representation and acting on another defeats coverage. In XML signature wrapping attacks, the signature covers one element of an XML (Extensible Markup Language) document, and the attacker moves that element and puts an unsigned element where the application reads. In 2013 a flaw in Android’s app installer allowed an app archive to contain two files with the same name; the signature check examined one and the installer used the other [352]. Both break the same-bytes condition.
Re-encoding breaks coverage. Authenticating a parsed and re-serialized object, such as a JSON §12.26 (JavaScript Object Notation) object whose key order or spacing may change, needs a canonical encoding with exact rules, such as Canonical JSON §12.28. Otherwise, authenticate the exact bytes received.
Covering a hash of a field instead of the field is equivalent only if the hash function is collision-resistant §5.5 and the receiver checks the field against the hash before using it.
A function named after authentication §1.6 proves nothing by its name. The coverage is whatever the code actually passes to the MAC computation.
Questions answered
Are version, device identity, opcode §2.8, lengths, and mode bound to the same tag?
They must be: each of these fields changes what the receiver does or how it reads the message, so each must lie inside the bytes covered by the one tag, or be taken by the receiver from its own trusted state and included when it recomputes the tag. The tag is the short value that a message authentication code (MAC) computes from a secret key and the covered bytes; a field outside those bytes can be changed without detection.
Version selects how the other fields are parsed; uncovered, it lets valid bytes be read under a different format.
Device identity: without it, a message for one device is accepted by any other device that shares the key.
The opcode, the code naming the requested operation: without it, a tag made for a harmless operation is valid for a harmful one.
Lengths decide where one field ends and the next begins; uncovered, they let the same covered bytes be split into different fields.
Mode, such as the algorithm §14.1 or the tag length, changes how the message is processed and how strong the check is.
One tag over all of them, rather than a tag per part, also stops an attacker from combining parts of two valid messages. To check a real system, write down the exact bytes passed to the MAC computation, change each field in turn in a test and confirm that verification fails each time, and confirm that the receiver acts on fields parsed from those same verified bytes.
Related entries: Domain separation (§5.22), Trust boundary (§1.3), Serialization (§4.28), Replay attack (§1.26), Authenticated encryption (AEAD) (§5.16), Canonical JSON (§12.28), Robustness principle and strict parsing (§1.48). Further reading: [351, 352].