908-v2.6-0008-FT-Do-not-allow-multiple-Reassociation-Response-fram.patch 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. From b372ab0b7daea719749194dc554b26e6367603f2 Mon Sep 17 00:00:00 2001
  2. From: Jouni Malinen <j@w1.fi>
  3. Date: Fri, 22 Sep 2017 12:06:37 +0300
  4. Subject: [PATCH 8/8] FT: Do not allow multiple Reassociation Response frames
  5. The driver is expected to not report a second association event without
  6. the station having explicitly request a new association. As such, this
  7. case should not be reachable. However, since reconfiguring the same
  8. pairwise or group keys to the driver could result in nonce reuse issues,
  9. be extra careful here and do an additional state check to avoid this
  10. even if the local driver ends up somehow accepting an unexpected
  11. Reassociation Response frame.
  12. Signed-off-by: Jouni Malinen <j@w1.fi>
  13. ---
  14. src/rsn_supp/wpa.c | 3 +++
  15. src/rsn_supp/wpa_ft.c | 8 ++++++++
  16. src/rsn_supp/wpa_i.h | 1 +
  17. 3 files changed, 12 insertions(+)
  18. diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c
  19. index 0550a41..2a53c6f 100644
  20. --- a/src/rsn_supp/wpa.c
  21. +++ b/src/rsn_supp/wpa.c
  22. @@ -2440,6 +2440,9 @@ void wpa_sm_notify_disassoc(struct wpa_sm *sm)
  23. #ifdef CONFIG_TDLS
  24. wpa_tdls_disassoc(sm);
  25. #endif /* CONFIG_TDLS */
  26. +#ifdef CONFIG_IEEE80211R
  27. + sm->ft_reassoc_completed = 0;
  28. +#endif /* CONFIG_IEEE80211R */
  29. /* Keys are not needed in the WPA state machine anymore */
  30. wpa_sm_drop_sa(sm);
  31. diff --git a/src/rsn_supp/wpa_ft.c b/src/rsn_supp/wpa_ft.c
  32. index 205793e..d45bb45 100644
  33. --- a/src/rsn_supp/wpa_ft.c
  34. +++ b/src/rsn_supp/wpa_ft.c
  35. @@ -153,6 +153,7 @@ static u8 * wpa_ft_gen_req_ies(struct wpa_sm *sm, size_t *len,
  36. u16 capab;
  37. sm->ft_completed = 0;
  38. + sm->ft_reassoc_completed = 0;
  39. buf_len = 2 + sizeof(struct rsn_mdie) + 2 + sizeof(struct rsn_ftie) +
  40. 2 + sm->r0kh_id_len + ric_ies_len + 100;
  41. @@ -681,6 +682,11 @@ int wpa_ft_validate_reassoc_resp(struct wpa_sm *sm, const u8 *ies,
  42. return -1;
  43. }
  44. + if (sm->ft_reassoc_completed) {
  45. + wpa_printf(MSG_DEBUG, "FT: Reassociation has already been completed for this FT protocol instance - ignore unexpected retransmission");
  46. + return 0;
  47. + }
  48. +
  49. if (wpa_ft_parse_ies(ies, ies_len, &parse) < 0) {
  50. wpa_printf(MSG_DEBUG, "FT: Failed to parse IEs");
  51. return -1;
  52. @@ -781,6 +787,8 @@ int wpa_ft_validate_reassoc_resp(struct wpa_sm *sm, const u8 *ies,
  53. return -1;
  54. }
  55. + sm->ft_reassoc_completed = 1;
  56. +
  57. if (wpa_ft_process_gtk_subelem(sm, parse.gtk, parse.gtk_len) < 0)
  58. return -1;
  59. diff --git a/src/rsn_supp/wpa_i.h b/src/rsn_supp/wpa_i.h
  60. index 41f371f..56f88dc 100644
  61. --- a/src/rsn_supp/wpa_i.h
  62. +++ b/src/rsn_supp/wpa_i.h
  63. @@ -128,6 +128,7 @@ struct wpa_sm {
  64. size_t r0kh_id_len;
  65. u8 r1kh_id[FT_R1KH_ID_LEN];
  66. int ft_completed;
  67. + int ft_reassoc_completed;
  68. int over_the_ds_in_progress;
  69. u8 target_ap[ETH_ALEN]; /* over-the-DS target AP */
  70. int set_ptk_after_assoc;
  71. --
  72. 2.7.4