Skip to contentSkip to conversation

hostapd: apply upstream security patches

PATCH New Baruch Siach 2 participants 4 messages May 4, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 hostapd: apply upstream security patches

This commit adds patches for three different upstream security advisories. No CVE numbers stated.

http://w1.fi/security/2015-2/wps-upnp-http-chunked-transfer-encoding.txt
http://w1.fi/security/2015-3/integer-underflow-in-ap-mode-wmm-action-frame.txt
http://w1.fi/security/2015-4/eap-pwd-missing-payload-length-validation.txt

---
 ...Fix-HTTP-chunked-transfer-encoding-parser.patch |  50 +++++++
 ...integer-underflow-in-WMM-Action-frame-par.patch |  42 ++++++
 package/hostapd/0003-EAP-pwd-fixes.patch           | 154 +++++++++++++++++++++
 3 files changed, 246 insertions(+)
 create mode 100644 package/hostapd/0001-WPS-Fix-HTTP-chunked-transfer-encoding-parser.patch
 create mode 100644 package/hostapd/0002-AP-WMM-Fix-integer-underflow-in-WMM-Action-frame-par.patch
 create mode 100644 package/hostapd/0003-EAP-pwd-fixes.patch
package/hostapd/0001-WPS-Fix-HTTP-chunked-transfer-encoding-parser.patch new file +50 -0
new file mode 100644
index 000000000000..d9dccf911669
@@ -0,0 +1,50 @@
+From 5acd23f4581da58683f3cf5e36cb71bbe4070bd7 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <[email protected]>
+Date: Tue, 28 Apr 2015 17:08:33 +0300
+Subject: [PATCH] WPS: Fix HTTP chunked transfer encoding parser
+
+strtoul() return value may end up overflowing the int h->chunk_size and
+resulting in a negative value to be stored as the chunk_size. This could
+result in the following memcpy operation using a very large length
+argument which would result in a buffer overflow and segmentation fault.
+
+This could have been used to cause a denial service by any device that
+has been authorized for network access (either wireless or wired). This
+would affect both the WPS UPnP functionality in a WPS AP (hostapd with
+upnp_iface parameter set in the configuration) and WPS ER
+(wpa_supplicant with WPS_ER_START control interface command used).
+
+Validate the parsed chunk length value to avoid this. In addition to
+rejecting negative values, we can also reject chunk size that would be
+larger than the maximum configured body length.
+
+Thanks to Kostya Kortchinsky of Google security team for discovering and
+reporting this issue.
+
+Signed-off-by: Jouni Malinen <[email protected]>
+Signed-off-by: Baruch Siach <[email protected]>
+---
+ src/wps/httpread.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/src/wps/httpread.c b/src/wps/httpread.c
+index 2f08f37275c0..d2855e32fd0f 100644
+--- a/src/wps/httpread.c
++++ b/src/wps/httpread.c
+@@ -533,6 +533,13 @@ static void httpread_read_handler(int sd, void *eloop_ctx, void *sock_ctx)
+ 					if (!isxdigit(*cbp))
+ 						goto bad;
+ 					h->chunk_size = strtoul(cbp, NULL, 16);
++					if (h->chunk_size < 0 ||
++					    h->chunk_size > h->max_bytes) {
++						wpa_printf(MSG_DEBUG,
++							   "httpread: Invalid chunk size %d",
++							   h->chunk_size);
++						goto bad;
++					}
+ 					/* throw away chunk header
+ 					 * so we have only real data
+ 					 */
+-- 
+2.1.4
+
package/hostapd/0002-AP-WMM-Fix-integer-underflow-in-WMM-Action-frame-par.patch new file +42 -0

42 lines not on this page · raw message

package/hostapd/0003-EAP-pwd-fixes.patch new file +154 -0

154 lines not on this page · raw message

Signature · 1 line
2.1.4
#1 lore raw

PATCH 2/2 wpa_supplicant: apply upstream security patches

This commit adds patches for three different upstream security advisories. No CVE numbers stated.

http://w1.fi/security/2015-2/wps-upnp-http-chunked-transfer-encoding.txt
http://w1.fi/security/2015-3/integer-underflow-in-ap-mode-wmm-action-frame.txt
http://w1.fi/security/2015-4/eap-pwd-missing-payload-length-validation.txt

---
 ...Fix-HTTP-chunked-transfer-encoding-parser.patch |  50 +++++++
 ...integer-underflow-in-WMM-Action-frame-par.patch |  42 ++++++
 package/wpa_supplicant/0004-EAP-pwd-fixes.patch    | 154 +++++++++++++++++++++
 3 files changed, 246 insertions(+)
 create mode 100644 package/wpa_supplicant/0002-WPS-Fix-HTTP-chunked-transfer-encoding-parser.patch
 create mode 100644 package/wpa_supplicant/0003-AP-WMM-Fix-integer-underflow-in-WMM-Action-frame-par.patch
 create mode 100644 package/wpa_supplicant/0004-EAP-pwd-fixes.patch
package/wpa_supplicant/0002-WPS-Fix-HTTP-chunked-transfer-encoding-parser.patch new file +50 -0
new file mode 100644
index 000000000000..d9dccf911669
@@ -0,0 +1,50 @@
+From 5acd23f4581da58683f3cf5e36cb71bbe4070bd7 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <[email protected]>
+Date: Tue, 28 Apr 2015 17:08:33 +0300
+Subject: [PATCH] WPS: Fix HTTP chunked transfer encoding parser
+
+strtoul() return value may end up overflowing the int h->chunk_size and
+resulting in a negative value to be stored as the chunk_size. This could
+result in the following memcpy operation using a very large length
+argument which would result in a buffer overflow and segmentation fault.
+
+This could have been used to cause a denial service by any device that
+has been authorized for network access (either wireless or wired). This
+would affect both the WPS UPnP functionality in a WPS AP (hostapd with
+upnp_iface parameter set in the configuration) and WPS ER
+(wpa_supplicant with WPS_ER_START control interface command used).
+
+Validate the parsed chunk length value to avoid this. In addition to
+rejecting negative values, we can also reject chunk size that would be
+larger than the maximum configured body length.
+
+Thanks to Kostya Kortchinsky of Google security team for discovering and
+reporting this issue.
+
+Signed-off-by: Jouni Malinen <[email protected]>
+Signed-off-by: Baruch Siach <[email protected]>
+---
+ src/wps/httpread.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/src/wps/httpread.c b/src/wps/httpread.c
+index 2f08f37275c0..d2855e32fd0f 100644
+--- a/src/wps/httpread.c
++++ b/src/wps/httpread.c
+@@ -533,6 +533,13 @@ static void httpread_read_handler(int sd, void *eloop_ctx, void *sock_ctx)
+ 					if (!isxdigit(*cbp))
+ 						goto bad;
+ 					h->chunk_size = strtoul(cbp, NULL, 16);
++					if (h->chunk_size < 0 ||
++					    h->chunk_size > h->max_bytes) {
++						wpa_printf(MSG_DEBUG,
++							   "httpread: Invalid chunk size %d",
++							   h->chunk_size);
++						goto bad;
++					}
+ 					/* throw away chunk header
+ 					 * so we have only real data
+ 					 */
+-- 
+2.1.4
+
package/wpa_supplicant/0003-AP-WMM-Fix-integer-underflow-in-WMM-Action-frame-par.patch new file +42 -0

42 lines not on this page · raw message

package/wpa_supplicant/0004-EAP-pwd-fixes.patch new file +154 -0

154 lines not on this page · raw message

Signature · 1 line
2.1.4
#2 lore raw

PATCH 2/2 wpa_supplicant: apply upstream security patches

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

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

This commit adds patches for three different upstream security advisories. No CVE numbers stated.

http://w1.fi/security/2015-2/wps-upnp-http-chunked-transfer-encoding.txt
http://w1.fi/security/2015-3/integer-underflow-in-ap-mode-wmm-action-frame.txt
http://w1.fi/security/2015-4/eap-pwd-missing-payload-length-validation.txt

Committed, thanks.

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

PATCH 1/2 hostapd: apply upstream security patches

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:

This commit adds patches for three different upstream security advisories. No CVE numbers stated.

http://w1.fi/security/2015-2/wps-upnp-http-chunked-transfer-encoding.txt
http://w1.fi/security/2015-3/integer-underflow-in-ap-mode-wmm-action-frame.txt
http://w1.fi/security/2015-4/eap-pwd-missing-payload-length-validation.txt

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard