|
|
9dcd88 |
From 8c07fa9eda13e835f3f968b2e1c9a8be3a851ff9 Mon Sep 17 00:00:00 2001
|
|
|
9dcd88 |
From: Jouni Malinen <j@w1.fi>
|
|
|
9dcd88 |
Date: Thu, 29 Aug 2019 11:52:04 +0300
|
|
|
9dcd88 |
Subject: [PATCH] AP: Silently ignore management frame from unexpected source
|
|
|
9dcd88 |
address
|
|
|
9dcd88 |
|
|
|
9dcd88 |
Do not process any received Management frames with unexpected/invalid SA
|
|
|
9dcd88 |
so that we do not add any state for unexpected STA addresses or end up
|
|
|
9dcd88 |
sending out frames to unexpected destination. This prevents unexpected
|
|
|
9dcd88 |
sequences where an unprotected frame might end up causing the AP to send
|
|
|
9dcd88 |
out a response to another device and that other device processing the
|
|
|
9dcd88 |
unexpected response.
|
|
|
9dcd88 |
|
|
|
9dcd88 |
In particular, this prevents some potential denial of service cases
|
|
|
9dcd88 |
where the unexpected response frame from the AP might result in a
|
|
|
9dcd88 |
connected station dropping its association.
|
|
|
9dcd88 |
|
|
|
9dcd88 |
Signed-off-by: Jouni Malinen <j@w1.fi>
|
|
|
9dcd88 |
---
|
|
|
9dcd88 |
src/ap/drv_callbacks.c | 13 +++++++++++++
|
|
|
9dcd88 |
src/ap/ieee802_11.c | 12 ++++++++++++
|
|
|
9dcd88 |
2 files changed, 25 insertions(+)
|
|
|
9dcd88 |
|
|
|
9dcd88 |
diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c
|
|
|
9dcd88 |
index 31587685fe3b..34ca379edc3d 100644
|
|
|
9dcd88 |
--- a/src/ap/drv_callbacks.c
|
|
|
9dcd88 |
+++ b/src/ap/drv_callbacks.c
|
|
|
9dcd88 |
@@ -131,6 +131,19 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
|
|
|
9dcd88 |
"hostapd_notif_assoc: Skip event with no address");
|
|
|
9dcd88 |
return -1;
|
|
|
9dcd88 |
}
|
|
|
9dcd88 |
+
|
|
|
9dcd88 |
+ if (is_multicast_ether_addr(addr) ||
|
|
|
9dcd88 |
+ is_zero_ether_addr(addr) ||
|
|
|
9dcd88 |
+ os_memcmp(addr, hapd->own_addr, ETH_ALEN) == 0) {
|
|
|
9dcd88 |
+ /* Do not process any frames with unexpected/invalid SA so that
|
|
|
9dcd88 |
+ * we do not add any state for unexpected STA addresses or end
|
|
|
9dcd88 |
+ * up sending out frames to unexpected destination. */
|
|
|
9dcd88 |
+ wpa_printf(MSG_DEBUG, "%s: Invalid SA=" MACSTR
|
|
|
9dcd88 |
+ " in received indication - ignore this indication silently",
|
|
|
9dcd88 |
+ __func__, MAC2STR(addr));
|
|
|
9dcd88 |
+ return 0;
|
|
|
9dcd88 |
+ }
|
|
|
9dcd88 |
+
|
|
|
9dcd88 |
random_add_randomness(addr, ETH_ALEN);
|
|
|
9dcd88 |
|
|
|
9dcd88 |
hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211,
|
|
|
9dcd88 |
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
|
|
|
9dcd88 |
index c85a28db44b7..e7065372e158 100644
|
|
|
9dcd88 |
--- a/src/ap/ieee802_11.c
|
|
|
9dcd88 |
+++ b/src/ap/ieee802_11.c
|
|
|
9dcd88 |
@@ -4626,6 +4626,18 @@ int ieee802_11_mgmt(struct hostapd_data *hapd, const u8 *buf, size_t len,
|
|
|
9dcd88 |
fc = le_to_host16(mgmt->frame_control);
|
|
|
9dcd88 |
stype = WLAN_FC_GET_STYPE(fc);
|
|
|
9dcd88 |
|
|
|
9dcd88 |
+ if (is_multicast_ether_addr(mgmt->sa) ||
|
|
|
9dcd88 |
+ is_zero_ether_addr(mgmt->sa) ||
|
|
|
9dcd88 |
+ os_memcmp(mgmt->sa, hapd->own_addr, ETH_ALEN) == 0) {
|
|
|
9dcd88 |
+ /* Do not process any frames with unexpected/invalid SA so that
|
|
|
9dcd88 |
+ * we do not add any state for unexpected STA addresses or end
|
|
|
9dcd88 |
+ * up sending out frames to unexpected destination. */
|
|
|
9dcd88 |
+ wpa_printf(MSG_DEBUG, "MGMT: Invalid SA=" MACSTR
|
|
|
9dcd88 |
+ " in received frame - ignore this frame silently",
|
|
|
9dcd88 |
+ MAC2STR(mgmt->sa));
|
|
|
9dcd88 |
+ return 0;
|
|
|
9dcd88 |
+ }
|
|
|
9dcd88 |
+
|
|
|
9dcd88 |
if (stype == WLAN_FC_STYPE_BEACON) {
|
|
|
9dcd88 |
handle_beacon(hapd, mgmt, len, fi);
|
|
|
9dcd88 |
return 1;
|
|
|
9dcd88 |
--
|
|
|
9dcd88 |
2.20.1
|
|
|
9dcd88 |
|