Skip to contentSkip to conversation

hostapd: add security fix

PATCH New Baruch Siach 2 participants 4 messages May 3, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 hostapd: add security fix

Add upstream patch fixing CVE-2016-2447: psk configuration parameter update allowing arbitrary data to be written.

See http://w1.fi/security/2016-1/psk-parameter-config-update.txt for details.

---
 ...ject-a-Credential-with-invalid-passphrase.patch | 85 ++++++++++++++++++++++
 1 file changed, 85 insertions(+)
 create mode 100644 package/hostapd/0005-WPS-Reject-a-Credential-with-invalid-passphrase.patch
package/hostapd/0005-WPS-Reject-a-Credential-with-invalid-passphrase.patch new file +85 -0
new file mode 100644
index 000000000000..282aa952b5a2
@@ -0,0 +1,85 @@
+From ecbb0b3dc122b0d290987cf9c84010bbe53e1022 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <[email protected]>
+Date: Fri, 4 Mar 2016 17:20:18 +0200
+Subject: [PATCH] WPS: Reject a Credential with invalid passphrase
+
+WPA/WPA2-Personal passphrase is not allowed to include control
+characters. Reject a Credential received from a WPS Registrar both as
+STA (Credential) and AP (AP Settings) if the credential is for WPAPSK or
+WPA2PSK authentication type and includes an invalid passphrase.
+
+This fixes an issue where hostapd or wpa_supplicant could have updated
+the configuration file PSK/passphrase parameter with arbitrary data from
+an external device (Registrar) that may not be fully trusted. Should
+such data include a newline character, the resulting configuration file
+could become invalid and fail to be parsed.
+
+Signed-off-by: Jouni Malinen <[email protected]>
+Signed-off-by: Baruch Siach <[email protected]>
+---
+Patch status: upstream (ecbb0b3dc122b0d290987cf9c84010bbe53e1022)
+
+ src/utils/common.c         | 12 ++++++++++++
+ src/utils/common.h         |  1 +
+ src/wps/wps_attr_process.c | 10 ++++++++++
+ 3 files changed, 23 insertions(+)
+
+diff --git a/src/utils/common.c b/src/utils/common.c
+index 450e2c6519ba..27b7c02de10b 100644
+--- a/src/utils/common.c
++++ b/src/utils/common.c
+@@ -697,6 +697,18 @@ int is_hex(const u8 *data, size_t len)
+ }
+ 
+ 
++int has_ctrl_char(const u8 *data, size_t len)
++{
++	size_t i;
++
++	for (i = 0; i < len; i++) {
++		if (data[i] < 32 || data[i] == 127)
++			return 1;
++	}
++	return 0;
++}
++
++
+ size_t merge_byte_arrays(u8 *res, size_t res_len,
+ 			 const u8 *src1, size_t src1_len,
+ 			 const u8 *src2, size_t src2_len)
+diff --git a/src/utils/common.h b/src/utils/common.h
+index 701dbb236ed5..a97224070385 100644
+--- a/src/utils/common.h
++++ b/src/utils/common.h
+@@ -488,6 +488,7 @@ const char * wpa_ssid_txt(const u8 *ssid, size_t ssid_len);
+ 
+ char * wpa_config_parse_string(const char *value, size_t *len);
+ int is_hex(const u8 *data, size_t len);
++int has_ctrl_char(const u8 *data, size_t len);
+ size_t merge_byte_arrays(u8 *res, size_t res_len,
+ 			 const u8 *src1, size_t src1_len,
+ 			 const u8 *src2, size_t src2_len);
+diff --git a/src/wps/wps_attr_process.c b/src/wps/wps_attr_process.c
+index eadb22fe2e78..e8c4579309ab 100644
+--- a/src/wps/wps_attr_process.c
++++ b/src/wps/wps_attr_process.c
+@@ -229,6 +229,16 @@ static int wps_workaround_cred_key(struct wps_credential *cred)
+ 		cred->key_len--;
+ #endif /* CONFIG_WPS_STRICT */
+ 	}
++
++
++	if (cred->auth_type & (WPS_AUTH_WPAPSK | WPS_AUTH_WPA2PSK) &&
++	    (cred->key_len < 8 || has_ctrl_char(cred->key, cred->key_len))) {
++		wpa_printf(MSG_INFO, "WPS: Reject credential with invalid WPA/WPA2-Personal passphrase");
++		wpa_hexdump_ascii_key(MSG_INFO, "WPS: Network Key",
++				      cred->key, cred->key_len);
++		return -1;
++	}
++
+ 	return 0;
+ }
+ 
+-- 
+2.8.1
+
Signature · 1 line
2.8.1
#1 lore raw

PATCH 2/2 wpa_supplicant: add security fixes

Add upstream patching fixing CVE-2016-2447: psk configuration parameter update allowing arbitrary data to be written.

See http://w1.fi/security/2016-1/psk-parameter-config-update.txt for details.

---
 ...ject-a-Credential-with-invalid-passphrase.patch | 85 ++++++++++++++++++++++
 ...parameter-set-with-invalid-passphrase-cha.patch | 53 ++++++++++++++
 ...ines-from-wpa_supplicant-config-network-o.patch | 84 +++++++++++++++++++++
 ...CRED-commands-with-newline-characters-in-.patch | 65 +++++++++++++++++
 ...commands-with-newline-characters-in-the-s.patch | 53 ++++++++++++++
 5 files changed, 340 insertions(+)
 create mode 100644 package/wpa_supplicant/0008-WPS-Reject-a-Credential-with-invalid-passphrase.patch
 create mode 100644 package/wpa_supplicant/0009-Reject-psk-parameter-set-with-invalid-passphrase-cha.patch
 create mode 100644 package/wpa_supplicant/0010-Remove-newlines-from-wpa_supplicant-config-network-o.patch
 create mode 100644 package/wpa_supplicant/0011-Reject-SET_CRED-commands-with-newline-characters-in-.patch
 create mode 100644 package/wpa_supplicant/0012-Reject-SET-commands-with-newline-characters-in-the-s.patch
package/wpa_supplicant/0008-WPS-Reject-a-Credential-with-invalid-passphrase.patch new file +85 -0
new file mode 100644
index 000000000000..282aa952b5a2
@@ -0,0 +1,85 @@
+From ecbb0b3dc122b0d290987cf9c84010bbe53e1022 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <[email protected]>
+Date: Fri, 4 Mar 2016 17:20:18 +0200
+Subject: [PATCH] WPS: Reject a Credential with invalid passphrase
+
+WPA/WPA2-Personal passphrase is not allowed to include control
+characters. Reject a Credential received from a WPS Registrar both as
+STA (Credential) and AP (AP Settings) if the credential is for WPAPSK or
+WPA2PSK authentication type and includes an invalid passphrase.
+
+This fixes an issue where hostapd or wpa_supplicant could have updated
+the configuration file PSK/passphrase parameter with arbitrary data from
+an external device (Registrar) that may not be fully trusted. Should
+such data include a newline character, the resulting configuration file
+could become invalid and fail to be parsed.
+
+Signed-off-by: Jouni Malinen <[email protected]>
+Signed-off-by: Baruch Siach <[email protected]>
+---
+Patch status: upstream (ecbb0b3dc122b0d290987cf9c84010bbe53e1022)
+
+ src/utils/common.c         | 12 ++++++++++++
+ src/utils/common.h         |  1 +
+ src/wps/wps_attr_process.c | 10 ++++++++++
+ 3 files changed, 23 insertions(+)
+
+diff --git a/src/utils/common.c b/src/utils/common.c
+index 450e2c6519ba..27b7c02de10b 100644
+--- a/src/utils/common.c
++++ b/src/utils/common.c
+@@ -697,6 +697,18 @@ int is_hex(const u8 *data, size_t len)
+ }
+ 
+ 
++int has_ctrl_char(const u8 *data, size_t len)
++{
++	size_t i;
++
++	for (i = 0; i < len; i++) {
++		if (data[i] < 32 || data[i] == 127)
++			return 1;
++	}
++	return 0;
++}
++
++
+ size_t merge_byte_arrays(u8 *res, size_t res_len,
+ 			 const u8 *src1, size_t src1_len,
+ 			 const u8 *src2, size_t src2_len)
+diff --git a/src/utils/common.h b/src/utils/common.h
+index 701dbb236ed5..a97224070385 100644
+--- a/src/utils/common.h
++++ b/src/utils/common.h
+@@ -488,6 +488,7 @@ const char * wpa_ssid_txt(const u8 *ssid, size_t ssid_len);
+ 
+ char * wpa_config_parse_string(const char *value, size_t *len);
+ int is_hex(const u8 *data, size_t len);
++int has_ctrl_char(const u8 *data, size_t len);
+ size_t merge_byte_arrays(u8 *res, size_t res_len,
+ 			 const u8 *src1, size_t src1_len,
+ 			 const u8 *src2, size_t src2_len);
+diff --git a/src/wps/wps_attr_process.c b/src/wps/wps_attr_process.c
+index eadb22fe2e78..e8c4579309ab 100644
+--- a/src/wps/wps_attr_process.c
++++ b/src/wps/wps_attr_process.c
+@@ -229,6 +229,16 @@ static int wps_workaround_cred_key(struct wps_credential *cred)
+ 		cred->key_len--;
+ #endif /* CONFIG_WPS_STRICT */
+ 	}
++
++
++	if (cred->auth_type & (WPS_AUTH_WPAPSK | WPS_AUTH_WPA2PSK) &&
++	    (cred->key_len < 8 || has_ctrl_char(cred->key, cred->key_len))) {
++		wpa_printf(MSG_INFO, "WPS: Reject credential with invalid WPA/WPA2-Personal passphrase");
++		wpa_hexdump_ascii_key(MSG_INFO, "WPS: Network Key",
++				      cred->key, cred->key_len);
++		return -1;
++	}
++
+ 	return 0;
+ }
+ 
+-- 
+2.8.1
+
package/wpa_supplicant/0009-Reject-psk-parameter-set-with-invalid-passphrase-cha.patch new file +53 -0

53 lines not on this page · raw message

package/wpa_supplicant/0010-Remove-newlines-from-wpa_supplicant-config-network-o.patch new file +84 -0

84 lines not on this page · raw message

package/wpa_supplicant/0011-Reject-SET_CRED-commands-with-newline-characters-in-.patch new file +65 -0

65 lines not on this page · raw message

package/wpa_supplicant/0012-Reject-SET-commands-with-newline-characters-in-the-s.patch new file +53 -0

53 lines not on this page · raw message

Signature · 1 line
2.8.1
#2 lore raw

PATCH 2/2 wpa_supplicant: add security fixes

Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Baruch" == Baruch Siach <[email protected]> writes:

Add upstream patching fixing CVE-2016-2447: psk configuration parameter update
allowing arbitrary data to be written.

See http://w1.fi/security/2016-1/psk-parameter-config-update.txt for details.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH 1/2 hostapd: add security fix

In reply to Baruch Siach
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Baruch" == Baruch Siach <[email protected]> writes:

Add upstream patch fixing CVE-2016-2447: psk configuration parameter update
allowing arbitrary data to be written.

See http://w1.fi/security/2016-1/psk-parameter-config-update.txt for details.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard