CVE-2019-16275.patch 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. From 8c07fa9eda13e835f3f968b2e1c9a8be3a851ff9 Mon Sep 17 00:00:00 2001
  2. From: Jouni Malinen <j@w1.fi>
  3. Date: Thu, 29 Aug 2019 11:52:04 +0300
  4. Subject: [PATCH] AP: Silently ignore management frame from unexpected source
  5. address
  6. Do not process any received Management frames with unexpected/invalid SA
  7. so that we do not add any state for unexpected STA addresses or end up
  8. sending out frames to unexpected destination. This prevents unexpected
  9. sequences where an unprotected frame might end up causing the AP to send
  10. out a response to another device and that other device processing the
  11. unexpected response.
  12. In particular, this prevents some potential denial of service cases
  13. where the unexpected response frame from the AP might result in a
  14. connected station dropping its association.
  15. Signed-off-by: Jouni Malinen <j@w1.fi>
  16. ---
  17. src/ap/drv_callbacks.c | 13 +++++++++++++
  18. src/ap/ieee802_11.c | 12 ++++++++++++
  19. 2 files changed, 25 insertions(+)
  20. diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c
  21. index 31587685fe3b..34ca379edc3d 100644
  22. --- a/src/ap/drv_callbacks.c
  23. +++ b/src/ap/drv_callbacks.c
  24. @@ -131,6 +131,19 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
  25. "hostapd_notif_assoc: Skip event with no address");
  26. return -1;
  27. }
  28. +
  29. + if (is_multicast_ether_addr(addr) ||
  30. + is_zero_ether_addr(addr) ||
  31. + os_memcmp(addr, hapd->own_addr, ETH_ALEN) == 0) {
  32. + /* Do not process any frames with unexpected/invalid SA so that
  33. + * we do not add any state for unexpected STA addresses or end
  34. + * up sending out frames to unexpected destination. */
  35. + wpa_printf(MSG_DEBUG, "%s: Invalid SA=" MACSTR
  36. + " in received indication - ignore this indication silently",
  37. + __func__, MAC2STR(addr));
  38. + return 0;
  39. + }
  40. +
  41. random_add_randomness(addr, ETH_ALEN);
  42. hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211,
  43. diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
  44. index c85a28db44b7..e7065372e158 100644
  45. --- a/src/ap/ieee802_11.c
  46. +++ b/src/ap/ieee802_11.c
  47. @@ -4626,6 +4626,18 @@ int ieee802_11_mgmt(struct hostapd_data *hapd, const u8 *buf, size_t len,
  48. fc = le_to_host16(mgmt->frame_control);
  49. stype = WLAN_FC_GET_STYPE(fc);
  50. + if (is_multicast_ether_addr(mgmt->sa) ||
  51. + is_zero_ether_addr(mgmt->sa) ||
  52. + os_memcmp(mgmt->sa, hapd->own_addr, ETH_ALEN) == 0) {
  53. + /* Do not process any frames with unexpected/invalid SA so that
  54. + * we do not add any state for unexpected STA addresses or end
  55. + * up sending out frames to unexpected destination. */
  56. + wpa_printf(MSG_DEBUG, "MGMT: Invalid SA=" MACSTR
  57. + " in received frame - ignore this frame silently",
  58. + MAC2STR(mgmt->sa));
  59. + return 0;
  60. + }
  61. +
  62. if (stype == WLAN_FC_STYPE_BEACON) {
  63. handle_beacon(hapd, mgmt, len, fi);
  64. return 1;
  65. --
  66. 2.20.1