hostapd: fix post v2.4 security issues
[15.05/openwrt.git] / package / network / services / hostapd / patches / 010-WNM-Ignore-Key-Data-in-WNM-Sleep-Mode-Response-frame.patch
1 From 6b12d93d2c7428a34bfd4b3813ba339ed57b698a Mon Sep 17 00:00:00 2001
2 From: Jouni Malinen <j@w1.fi>
3 Date: Sun, 25 Oct 2015 15:45:50 +0200
4 Subject: [PATCH] WNM: Ignore Key Data in WNM Sleep Mode Response frame if no
5  PMF in use
6
7 WNM Sleep Mode Response frame is used to update GTK/IGTK only if PMF is
8 enabled. Verify that PMF is in use before using this field on station
9 side to avoid accepting unauthenticated key updates. (CVE-2015-5310)
10
11 Signed-off-by: Jouni Malinen <j@w1.fi>
12 ---
13  wpa_supplicant/wnm_sta.c | 6 ++++++
14  1 file changed, 6 insertions(+)
15
16 diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c
17 index 954de67..7d79499 100644
18 --- a/wpa_supplicant/wnm_sta.c
19 +++ b/wpa_supplicant/wnm_sta.c
20 @@ -187,6 +187,12 @@ static void wnm_sleep_mode_exit_success(struct wpa_supplicant *wpa_s,
21         end = ptr + key_len_total;
22         wpa_hexdump_key(MSG_DEBUG, "WNM: Key Data", ptr, key_len_total);
23  
24 +       if (key_len_total && !wpa_sm_pmf_enabled(wpa_s->wpa)) {
25 +               wpa_msg(wpa_s, MSG_INFO,
26 +                       "WNM: Ignore Key Data in WNM-Sleep Mode Response - PMF not enabled");
27 +               return;
28 +       }
29 +
30         while (ptr + 1 < end) {
31                 if (ptr + 2 + ptr[1] > end) {
32                         wpa_printf(MSG_DEBUG, "WNM: Invalid Key Data element "