RADIUS server: Place Message-Authenticator attribute as the first one

Move the Message-Authenticator attribute to be the first attribute in
the RADIUS messages. This mitigates certain MD5 attacks against
RADIUS/UDP.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2024-03-16 11:13:32 +02:00
parent adac846bd0
commit 54abb0d3cf

View file

@ -920,6 +920,11 @@ radius_server_encapsulate_eap(struct radius_server_data *data,
return NULL;
}
if (!radius_msg_add_msg_auth(msg)) {
radius_msg_free(msg);
return NULL;
}
sess_id = htonl(sess->sess_id);
if (code == RADIUS_CODE_ACCESS_CHALLENGE &&
!radius_msg_add_attr(msg, RADIUS_ATTR_STATE,
@ -1204,6 +1209,11 @@ radius_server_macacl(struct radius_server_data *data,
return NULL;
}
if (!radius_msg_add_msg_auth(msg)) {
radius_msg_free(msg);
return NULL;
}
if (radius_msg_copy_attr(msg, request, RADIUS_ATTR_PROXY_STATE) < 0) {
RADIUS_DEBUG("Failed to copy Proxy-State attribute(s)");
radius_msg_free(msg);
@ -1253,6 +1263,11 @@ static int radius_server_reject(struct radius_server_data *data,
return -1;
}
if (!radius_msg_add_msg_auth(msg)) {
radius_msg_free(msg);
return -1;
}
os_memset(&eapfail, 0, sizeof(eapfail));
eapfail.code = EAP_CODE_FAILURE;
eapfail.identifier = 0;