vanhoefm / krackattacks-scripts

Other
3.3k stars 770 forks source link

Some suggestion about the test script #75

Closed frog1224 closed 3 years ago

frog1224 commented 4 years ago

Hi: The original test script only reset client info when RX deauth/disassoc.

But I found deauth frame sometime may lost very easily on some DUTs. (DUT disconnected. But hostapd remain connected. Under this case, would encounter IV reuse detected when DUT associate back again)

May I suggest to also reset client info when RX AssocReq?

AssocReq won't lost, or DUT won't be able to associate.

DUT associate back would redo 4-way handshake.

IV should be able to restart from 0(?)


def handle_mon_rx(self): ... ... if Dot11AssocReq in p: if clientmac in self.clients: self.reset_client_info(clientmac) ... ...

Will this modification have any concern?

Sincerely YuChe.

vanhoefm commented 3 years ago

This sounds like a good suggestion! I think the following patch should handle this:

diff --git a/krackattack/krack-test-client.py b/krackattack/krack-test-client.py
index 715d430dc..453e632c4 100755
--- a/krackattack/krack-test-client.py
+++ b/krackattack/krack-test-client.py
@@ -327,7 +327,7 @@ class KRAckAttackClient():
                if apmac != self.apmac: return None

                # Reset info about disconnected clients
-               if Dot11Deauth in p or Dot11Disas in p:
+               if Dot11AssoReq in p or Dot11Deauth in p or Dot11Disas in p:
                        self.reset_client_info(clientmac)

                # Inspect encrypt frames for IV reuse & handle replayed frames rejected by the kernel

If anyone can test this patch in practice and confirm that it works, let me know, and I will merge it.

vanhoefm commented 3 years ago

This change has been included in the latest commit.