diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c
index 040ce6ed8..4e032d6b5 100644
--- a/src/rsn_supp/wpa.c
+++ b/src/rsn_supp/wpa.c
@@ -1727,9 +1727,22 @@ static int wpa_supplicant_install_igtk(struct wpa_sm *sm,
                keyidx, MAC2STR(igtk->pn));
        wpa_hexdump_key(MSG_DEBUG, "WPA: IGTK", igtk->igtk, len);
        if (keyidx > 4095) {
-               wpa_msg(sm->ctx->msg_ctx, MSG_WARNING,
-                       "WPA: Invalid IGTK KeyID %d", keyidx);
-               return -1;
+               int masked = keyidx & 0xFF;
+               if (masked == 4 || masked == 5) {
+                       /* Some APs send an IGTK KeyID larger than 4095 with
+                        * a valid key index (4 or 5) in the low byte and
+                        * spurious bits in the high byte. Mask off the high
+                        * byte and use the low byte as the key index instead
+                        * of rejecting the IGTK and disconnecting. */
+                       wpa_msg(sm->ctx->msg_ctx, MSG_INFO,
+                               "WPA: Workaround for non-compliant AP: corrected IGTK KeyID %d to %d",
+                               keyidx, masked);
+                       keyidx = masked;
+               } else {
+                       wpa_msg(sm->ctx->msg_ctx, MSG_WARNING,
+                               "WPA: Invalid IGTK KeyID %d", keyidx);
+                       return -1;
+               }
        }
        if (wpa_sm_set_key(sm, -1, wpa_cipher_to_alg(sm->mgmt_group_cipher),
                           broadcast_ether_addr,
