[PATCH v3] WPA: Add workaround for APs with byte-swapped IGTK KeyID

Jouni Malinen j at w1.fi
Mon Oct 5 06:22:30 PDT 2026


On Tue, Aug 25, 2026 at 03:25:33PM +0800, Chao Meng wrote:
> Some deployed APs with broken PMF implementations send IGTK KDE with
> byte-swapped KeyID values (e.g., 0x0400 instead of 0x0004), causing the
> keyidx > 4095 validation to reject the IGTK and force a disconnection.
> 
> Add a workaround that detects this case by checking whether the low byte
> of the KeyID is a valid key index (4 or 5). If so, use the corrected
> value and continue without disconnecting, logging an informational
> message instead of a warning.

There is a workaround for this exact described issues just below the
location that is being modified here..

> diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c
> @@ -1727,9 +1727,30 @@ static int wpa_supplicant_install_igtk(struct wpa_sm *sm,
>         if (keyidx > 4095) {

This code path is not reached when the received Key ID is 0x0400 or
0x0500..

> +               int masked = keyidx & 0xFF;
> +               if (masked == 4 || masked == 5) {

And this is not handling the byte-swapped case.. This seems to be for
ignoring what is in the higher end byte in cases where it happens to be
0x80 or higher..

> +                       /* Assume the AP has broken PMF implementation since it
> +                        * seems to have swapped the KeyID bytes. The AP cannot
> +                        * be trusted to implement BIP correctly or provide a
> +                        * valid IGTK, so do not try to configure this key with
> +                        * swapped KeyID bytes. Instead, continue without
> +                        * configuring the IGTK so that the driver can drop any
> +                        * received group-addressed robust management frames due
> +                        * to missing keys.

This description does not match what the proposed code is doing..

>         if (wpa_sm_set_key(sm, -1, wpa_cipher_to_alg(sm->mgmt_group_cipher),
>                            broadcast_ether_addr,

The existing workaround for 0x0400 and 0x0500 is in the failure case for
this call..
 
-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list