eap-aka: Make sure AT_RAND has the correct length in AKA-Challenge

This prevents an OOB read if the AT_RAND data is shorter than the
expected 16 bytes.

The check for AT_AUTN is changed for consistency even though its length
is already enforced by the parser (for AT_RAND it isn't because EAP-SIM
expects a length of either 32 or 48 bytes).

Fixes: aea334ec1c ("Splitted EAP-AKA in peer and server implementations, use libsimaka helper library")
This commit is contained in:
Tobias Brunner
2026-06-04 11:31:11 +02:00
parent a904f9125d
commit 4df53109a5
+1 -1
View File
@@ -244,7 +244,7 @@ static status_t process_challenge(private_eap_aka_peer_t *this,
}
enumerator->destroy(enumerator);
if (!rand.len || !autn.len)
if (rand.len != AKA_RAND_LEN || autn.len != AKA_AUTN_LEN)
{
DBG1(DBG_IKE, "received invalid EAP-AKA challenge message");
if (!create_client_error(this, out))