]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: Move Message-Authenticator attribute to be the first one in req
authorJouni Malinen <j@w1.fi>
Sat, 16 Mar 2024 09:22:43 +0000 (11:22 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 9 Jul 2024 11:58:39 +0000 (14:58 +0300)
Even if this is not strictly speaking necessary for mitigating certain
RADIUS protocol attacks, be consistent with the RADIUS server behavior
and move the Message-Authenticator attribute to be the first attribute
in the message from RADIUS client in hostapd.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/ap/ieee802_11_auth.c
src/ap/ieee802_1x.c

index 98a877dece146c69b0115789bf84d040d4c2e014..cc38044d8952f4884c956d163a630123e973fa72 100644 (file)
@@ -128,6 +128,9 @@ static int hostapd_radius_acl_query(struct hostapd_data *hapd, const u8 *addr,
                goto fail;
        }
 
+       if (!radius_msg_add_msg_auth(msg))
+               goto fail;
+
        os_snprintf(buf, sizeof(buf), RADIUS_ADDR_FORMAT, MAC2STR(addr));
        if (!radius_msg_add_attr(msg, RADIUS_ATTR_USER_NAME, (u8 *) buf,
                                 os_strlen(buf))) {
index 31a1120110ee7a1186175ac354f1ba0fcd8ca978..8394772c5f1126f218178d222a82d260bc005926 100644 (file)
@@ -767,6 +767,9 @@ void ieee802_1x_encapsulate_radius(struct hostapd_data *hapd,
                goto fail;
        }
 
+       if (!radius_msg_add_msg_auth(msg))
+               goto fail;
+
        if (sm->identity &&
            !radius_msg_add_attr(msg, RADIUS_ATTR_USER_NAME,
                                 sm->identity, sm->identity_len)) {