014-WPA-Extra-defense-against-PTK-reinstalls-in-4-way-ha.patch 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. From a00e946c1c9a1f9cc65c72900d2a444ceb1f872e Mon Sep 17 00:00:00 2001
  2. From: Mathy Vanhoef <Mathy.Vanhoef@cs.kuleuven.be>
  3. Date: Thu, 5 Oct 2017 23:53:01 +0200
  4. Subject: [PATCH] WPA: Extra defense against PTK reinstalls in 4-way handshake
  5. Currently, reinstallations of the PTK are prevented by (1) assuring the
  6. same TPTK is only set once as the PTK, and (2) that one particular PTK
  7. is only installed once. This patch makes it more explicit that point (1)
  8. is required to prevent key reinstallations. At the same time, this patch
  9. hardens wpa_supplicant such that future changes do not accidentally
  10. break this property.
  11. Signed-off-by: Mathy Vanhoef <Mathy.Vanhoef@cs.kuleuven.be>
  12. ---
  13. src/rsn_supp/wpa.c | 8 ++++++++
  14. 1 file changed, 8 insertions(+)
  15. --- a/src/rsn_supp/wpa.c
  16. +++ b/src/rsn_supp/wpa.c
  17. @@ -1728,6 +1728,14 @@ static int wpa_supplicant_verify_eapol_k
  18. sm->ptk_set = 1;
  19. os_memcpy(&sm->ptk, &sm->tptk, sizeof(sm->ptk));
  20. os_memset(&sm->tptk, 0, sizeof(sm->tptk));
  21. + /*
  22. + * This assures the same TPTK in sm->tptk can never be
  23. + * copied twice to sm->pkt as the new PTK. In
  24. + * combination with the installed flag in the wpa_ptk
  25. + * struct, this assures the same PTK is only installed
  26. + * once.
  27. + */
  28. + sm->renew_snonce = 1;
  29. }
  30. }