skip to content

What does the 8-octet CCMP header carry in a WPA2 data frame, and how does its packet number stop replayed frames?

level: middleimportance: should knowfreq 30%

answer

  1. six octets of counter, one of flags
  2. ExtIV bit and a 2-bit Key ID
  3. strictly greater than the last
  4. one window per priority

basics

~20 s

The CCMP header carries a 48-bit packet number, the ExtIV bit and a 2-bit Key ID. The sender increments the number per frame; the receiver drops any authenticated frame whose number is not higher than the last accepted.

solid answer

~50 s

The **CCMP header** sits between the MAC header and the encrypted body: six octets of **packet number (PN)**, PN0 and PN1 first, then a reserved octet, then an octet with the **ExtIV** bit (always set for CCMP) and the 2-bit **Key ID**, then PN2 to PN5. The transmitter increments the PN for each MPDU it encrypts under a key, and the PN is also part of the CCM nonce, so it is integrity-protected. The receiver keeps the last accepted PN per transmitter and key — for QoS data, one per traffic identifier (TID), because frames of different priorities can be reordered — and after the MIC verifies it discards any frame whose PN is not strictly greater. The Key ID tells the receiver which installed key to use, which is what lets a new group key take over without a gap.

go deeper

for a junior

Recall that the CCMP header holds a packet number and a Key ID, and that a receiver rejects frames whose number is not higher than the last.

for a middle

Lay out the eight octets, explain that the PN is part of the nonce, and state the strict greater-than rule with the order MIC first, PN second.

for a senior

Explain per-TID counters with reordering by access category, why retransmissions reuse a PN, and how Key IDs let group and pairwise keys overlap during rotation.

for a principal

Relate replay protection to operations: rekey and key-rotation settings, Extended Key ID support across a mixed client fleet, and what evidence shows a replay check is working.

## The CCMP header, octet by octet Every CCMP-protected MPDU carries an **8-octet CCMP header** between the 802.11 MAC header and the encrypted frame body. It is sent in the clear, because the receiver needs it before it can decrypt anything. | Octet | Content | |---|---| | 0 | PN0, the lowest octet of the packet number | | 1 | PN1 | | 2 | Reserved | | 3 | ExtIV bit (set) and the 2-bit Key ID | | 4-7 | PN2, PN3, PN4, PN5 | - The **packet number (PN)** is a 48-bit counter split across the header. - The **ExtIV** (extended IV) bit is always set for CCMP, signalling that the full 8-octet header is present. - The **Key ID** names which of the receiver's installed keys protected this frame. The PN is not merely a label: it is part of the 13-octet CCM nonce, together with the transmitter address and the frame's priority. A frame whose PN has been altered produces a different nonce, so its MIC fails. ## How the transmitter uses the packet number The transmitter keeps a PN for each temporal key it sends with and increments it for every MPDU it encrypts. Two consequences follow: - every newly encrypted frame gets a fresh PN, which is what keeps the CCM nonce unique under that key; - a MAC-level retransmission resends the *same* encrypted frame with the *same* PN, so the receiver sees it as a duplicate rather than as new data. A 48-bit counter allows about 2.8 × 10^14 frames per key. NIST SP 800-97 notes that this makes the temporal key's possible lifetime longer than any station–access point association, so wrap-around is not an operational concern. ## How the receiver enforces freshness For each key, and for each transmitter using a pairwise key, the receiver keeps a **replay counter** — the highest PN it has accepted. On every protected frame it works in this order: 1. Rebuild the nonce and AAD, decrypt, and verify the MIC. A frame with a bad MIC is dropped with no plaintext released, and its PN is never recorded. 2. Compare the frame's PN with the stored counter for that key and priority. 3. If the PN is **less than or equal to** the stored value, discard the frame as a replay — even though its MIC was valid. 4. Otherwise deliver the frame and store its PN as the new counter. The ordering matters: only authenticated frames can move the counter, so an unauthenticated frame cannot shift the window that legitimate traffic is checked against. The check is strict: an *equal* PN is a replay, not a tie. ## Why there is one counter per priority With QoS (WMM) traffic, a transmitter queues frames by access category, and a voice frame encrypted after a best-effort frame can leave the radio first. A single strict counter would then discard the delayed, legitimate best-effort frame. Receivers therefore keep **separate replay counters per traffic identifier (TID)** for QoS data from each transmitter, plus one for non-QoS frames. hostapd's wlantest analyser, the reference implementation's traffic checker, models exactly this: one counter for each of the 16 TIDs plus one more, per direction. Group-addressed traffic is tracked per group Key ID. ## The Key ID and key rotation The 2-bit Key ID lets two keys be installed at once: - **Group keys** alternate between Key IDs 1 and 2, so the access point can install a new group key alongside the old one and switch over without dropping frames still in flight. How the new group key is delivered is the four-way and group-key handshakes' subject. - **Pairwise keys** use Key ID 0 by default. *Extended Key ID for Individually Addressed frames* allows Key ID 0 or 1, so a pairwise rekey can overlap in the same way; in hostapd it is `extended_key_id`, default 0 (off). Each installed key has its own PN space and its own replay counters, which is why the Key ID must be read before the PN can be checked. ## What the packet number is not The PN is easy to confuse with the 802.11 **Sequence Control** field: | | Sequence number | CCMP packet number | |---|---|---| | Size | 12 bits plus a 4-bit fragment number | 48 bits | | Purpose | Duplicate detection and reassembly | Replay protection and nonce uniqueness | | Protected? | Masked out of the MIC (fragment number kept) | Bound into the nonce | | Wraps? | After 4,096 values | Not within any association | Replay protection rests on the PN alone; the sequence number gives no security guarantee.

  • Why does a WPA2 receiver check the packet number only after the MIC verifies?
    Because the packet number is only trustworthy once the MIC proves the frame came from a key holder and was not altered; the PN is bound into the nonce, so a valid MIC authenticates it. Recording PNs only from authenticated frames means nothing unauthenticated can advance the replay counter and cause legitimate frames to be discarded.
  • Does a MAC-level retransmission of a CCMP frame use a new packet number?
    No. A retransmission resends the same encrypted MPDU with the same PN and the Retry bit set; CCMP masks the Retry bit out of the AAD, so the copy still verifies. If the receiver already accepted the original, the repeated PN is not greater than its counter and the copy is discarded, which is the desired outcome.

A deli counter that serves by ticket number: the clerk serves a ticket only if its number is higher than the last one called, so a ticket fished out of the bin — equal or lower — is turned away even though it is genuine. Each counter (priority) calls its own sequence.

  • The 802.11 sequence number is what CCMP uses for replay protection.
  • A frame with a valid MIC is always accepted, whatever its packet number.
  • The receiver keeps one replay counter for all priorities of a client.
  • The Key ID field carries part of the key so the receiver can decrypt.
  • The 48-bit packet number wraps every few hours on a busy link.