1 Subject: mac80211: fix HT information element parsing
3 There's no checking that the HT IEs are of the right length
4 which can be used by an attacker to cause an out-of-bounds
5 access by sending a too short HT information/capability IE.
6 Fix it by simply pretending those IEs didn't exist when too
9 Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
11 net/mac80211/ieee80211_i.h | 6 ++----
12 net/mac80211/mlme.c | 3 ---
13 net/mac80211/util.c | 8 ++++----
14 3 files changed, 6 insertions(+), 11 deletions(-)
16 --- everything.orig/net/mac80211/ieee80211_i.h 2008-10-07 20:05:26.000000000 +0200
17 +++ everything/net/mac80211/ieee80211_i.h 2008-10-07 20:06:45.000000000 +0200
18 @@ -816,8 +816,8 @@ struct ieee802_11_elems {
24 + struct ieee80211_ht_cap *ht_cap_elem;
25 + struct ieee80211_ht_addt_info *ht_info_elem;
29 @@ -844,8 +844,6 @@ struct ieee802_11_elems {
30 u8 ext_supp_rates_len;
34 - u8 ht_info_elem_len;
38 --- everything.orig/net/mac80211/mlme.c 2008-10-07 20:06:44.000000000 +0200
39 +++ everything/net/mac80211/mlme.c 2008-10-07 20:06:45.000000000 +0200
40 @@ -1349,10 +1349,8 @@ static void ieee80211_rx_mgmt_assoc_resp
41 (ifsta->flags & IEEE80211_STA_WMM_ENABLED)) {
42 struct ieee80211_ht_bss_info bss_info;
43 ieee80211_ht_cap_ie_to_ht_info(
44 - (struct ieee80211_ht_cap *)
45 elems.ht_cap_elem, &sta->sta.ht_info);
46 ieee80211_ht_addt_info_ie_to_ht_bss_info(
47 - (struct ieee80211_ht_addt_info *)
48 elems.ht_info_elem, &bss_info);
49 ieee80211_handle_ht(local, 1, &sta->sta.ht_info, &bss_info);
51 @@ -1715,7 +1713,6 @@ static void ieee80211_rx_mgmt_beacon(str
52 struct ieee80211_ht_bss_info bss_info;
54 ieee80211_ht_addt_info_ie_to_ht_bss_info(
55 - (struct ieee80211_ht_addt_info *)
56 elems.ht_info_elem, &bss_info);
57 changed |= ieee80211_handle_ht(local, 1, &conf->ht_conf,
59 --- everything.orig/net/mac80211/util.c 2008-10-07 20:06:43.000000000 +0200
60 +++ everything/net/mac80211/util.c 2008-10-07 20:06:45.000000000 +0200
61 @@ -529,12 +529,12 @@ void ieee802_11_parse_elems(u8 *start, s
62 elems->ext_supp_rates_len = elen;
64 case WLAN_EID_HT_CAPABILITY:
65 - elems->ht_cap_elem = pos;
66 - elems->ht_cap_elem_len = elen;
67 + if (elen >= sizeof(struct ieee80211_ht_cap))
68 + elems->ht_cap_elem = (void *)pos;
70 case WLAN_EID_HT_EXTRA_INFO:
71 - elems->ht_info_elem = pos;
72 - elems->ht_info_elem_len = elen;
73 + if (elen >= sizeof(struct ieee80211_ht_addt_info))
74 + elems->ht_info_elem = (void *)pos;
76 case WLAN_EID_MESH_ID: