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