* ap: only accept message 4 after receiving message 2
@ 2024-01-29 16:11 Mathy Vanhoef
2024-01-30 3:02 ` Denis Kenzior
0 siblings, 1 reply; 2+ messages in thread
From: Mathy Vanhoef @ 2024-01-29 16:11 UTC (permalink / raw)
To: iwd
We found that when IWD is operating in AP mode, it doesn't verify
whether message 2 was already received before processing message 4.
I've included a candidate commit message and patch below. My mailing
client might destroy the spacing, but the small patch should
illustrate the possible fix.
---
When operating as an AP, drop message 4 of the 4-way handshake if the AP
has not yet received message 2. Otherwise an attacker can skip message 2
and immediately sent message 4 to bypass authentication (the AP would be
using an all-zero ptk to verify the authenticity of message 4).
---
src/eapol.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/eapol.c b/src/eapol.c
index bad4bbb7..3ce14d5c 100644
--- a/src/eapol.c
+++ b/src/eapol.c
@@ -2092,6 +2092,10 @@ static void eapol_handle_ptk_4_of_4(struct eapol_sm *sm,
if (L_BE64_TO_CPU(ek->key_replay_counter) != sm->replay_counter)
return;
+ /* Ensure we received Message 2 and thus have a PTK to verify MIC */
+ if (!sm->handshake->have_snonce)
+ return;
+
kck = handshake_state_get_kck(sm->handshake);
if (!eapol_verify_mic(sm->handshake->akm_suite, kck, ek,
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: ap: only accept message 4 after receiving message 2
2024-01-29 16:11 ap: only accept message 4 after receiving message 2 Mathy Vanhoef
@ 2024-01-30 3:02 ` Denis Kenzior
0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2024-01-30 3:02 UTC (permalink / raw)
To: Mathy Vanhoef, iwd
Hi Mathy,
On 1/29/24 10:11, Mathy Vanhoef wrote:
> We found that when IWD is operating in AP mode, it doesn't verify
> whether message 2 was already received before processing message 4.
>
> I've included a candidate commit message and patch below. My mailing
> client might destroy the spacing, but the small patch should
> illustrate the possible fix.
Ah nice catch. Thank you. I created a commit based on your patch /
description. Applied now as:
6415420f1c92 ("ap: only accept ptk 4/4 after receiving ptk 2/4")
Regards,
-Denis
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-01-30 3:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-29 16:11 ap: only accept message 4 after receiving message 2 Mathy Vanhoef
2024-01-30 3:02 ` Denis Kenzior
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox