Merge branch 'master' into gnome-updates
[jackhill/guix/guix.git] / gnu / packages / patches / wpa-supplicant-CVE-2016-4476.patch
1 From ecbb0b3dc122b0d290987cf9c84010bbe53e1022 Mon Sep 17 00:00:00 2001
2 From: Jouni Malinen <jouni@qca.qualcomm.com>
3 Date: Fri, 4 Mar 2016 17:20:18 +0200
4 Subject: [PATCH 1/5] WPS: Reject a Credential with invalid passphrase
5
6 WPA/WPA2-Personal passphrase is not allowed to include control
7 characters. Reject a Credential received from a WPS Registrar both as
8 STA (Credential) and AP (AP Settings) if the credential is for WPAPSK or
9 WPA2PSK authentication type and includes an invalid passphrase.
10
11 This fixes an issue where hostapd or wpa_supplicant could have updated
12 the configuration file PSK/passphrase parameter with arbitrary data from
13 an external device (Registrar) that may not be fully trusted. Should
14 such data include a newline character, the resulting configuration file
15 could become invalid and fail to be parsed.
16
17 Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
18 ---
19 src/utils/common.c | 12 ++++++++++++
20 src/utils/common.h | 1 +
21 src/wps/wps_attr_process.c | 10 ++++++++++
22 3 files changed, 23 insertions(+)
23
24 diff --git a/src/utils/common.c b/src/utils/common.c
25 index 450e2c6..27b7c02 100644
26 --- a/src/utils/common.c
27 +++ b/src/utils/common.c
28 @@ -697,6 +697,18 @@ int is_hex(const u8 *data, size_t len)
29 }
30
31
32 +int has_ctrl_char(const u8 *data, size_t len)
33 +{
34 + size_t i;
35 +
36 + for (i = 0; i < len; i++) {
37 + if (data[i] < 32 || data[i] == 127)
38 + return 1;
39 + }
40 + return 0;
41 +}
42 +
43 +
44 size_t merge_byte_arrays(u8 *res, size_t res_len,
45 const u8 *src1, size_t src1_len,
46 const u8 *src2, size_t src2_len)
47 diff --git a/src/utils/common.h b/src/utils/common.h
48 index 701dbb2..a972240 100644
49 --- a/src/utils/common.h
50 +++ b/src/utils/common.h
51 @@ -488,6 +488,7 @@ const char * wpa_ssid_txt(const u8 *ssid, size_t ssid_len);
52
53 char * wpa_config_parse_string(const char *value, size_t *len);
54 int is_hex(const u8 *data, size_t len);
55 +int has_ctrl_char(const u8 *data, size_t len);
56 size_t merge_byte_arrays(u8 *res, size_t res_len,
57 const u8 *src1, size_t src1_len,
58 const u8 *src2, size_t src2_len);
59 diff --git a/src/wps/wps_attr_process.c b/src/wps/wps_attr_process.c
60 index eadb22f..e8c4579 100644
61 --- a/src/wps/wps_attr_process.c
62 +++ b/src/wps/wps_attr_process.c
63 @@ -229,6 +229,16 @@ static int wps_workaround_cred_key(struct wps_credential *cred)
64 cred->key_len--;
65 #endif /* CONFIG_WPS_STRICT */
66 }
67 +
68 +
69 + if (cred->auth_type & (WPS_AUTH_WPAPSK | WPS_AUTH_WPA2PSK) &&
70 + (cred->key_len < 8 || has_ctrl_char(cred->key, cred->key_len))) {
71 + wpa_printf(MSG_INFO, "WPS: Reject credential with invalid WPA/WPA2-Personal passphrase");
72 + wpa_hexdump_ascii_key(MSG_INFO, "WPS: Network Key",
73 + cred->key, cred->key_len);
74 + return -1;
75 + }
76 +
77 return 0;
78 }
79
80 --
81 1.9.1
82