lkundrak / rpms / hostapd

Forked from rpms/hostapd 4 years ago
Clone

Blame hostapd-EAP-TLS-server-Fix-TLS-Message-Length-validation.patch

John W. Linville 11cd48b
From 586c446e0ff42ae00315b014924ec669023bd8de Mon Sep 17 00:00:00 2001
John W. Linville 11cd48b
From: Jouni Malinen <j@w1.fi>
John W. Linville 11cd48b
Date: Sun, 7 Oct 2012 20:06:29 +0300
John W. Linville 11cd48b
Subject: [PATCH] EAP-TLS server: Fix TLS Message Length validation
John W. Linville 11cd48b
John W. Linville 11cd48b
EAP-TLS/PEAP/TTLS/FAST server implementation did not validate TLS
John W. Linville 11cd48b
Message Length value properly and could end up trying to store more
John W. Linville 11cd48b
information into the message buffer than the allocated size if the first
John W. Linville 11cd48b
fragment is longer than the indicated size. This could result in hostapd
John W. Linville 11cd48b
process terminating in wpabuf length validation. Fix this by rejecting
John W. Linville 11cd48b
messages that have invalid TLS Message Length value.
John W. Linville 11cd48b
John W. Linville 11cd48b
This would affect cases that use the internal EAP authentication server
John W. Linville 11cd48b
in hostapd either directly with IEEE 802.1X or when using hostapd as a
John W. Linville 11cd48b
RADIUS authentication server and when receiving an incorrectly
John W. Linville 11cd48b
constructed EAP-TLS message. Cases where hostapd uses an external
John W. Linville 11cd48b
authentication are not affected.
John W. Linville 11cd48b
John W. Linville 11cd48b
Thanks to Timo Warns for finding and reporting this issue.
John W. Linville 11cd48b
John W. Linville 11cd48b
Signed-hostap: Jouni Malinen <j@w1.fi>
John W. Linville 11cd48b
intended-for: hostap-1
John W. Linville 11cd48b
---
John W. Linville 11cd48b
 src/eap_server/eap_server_tls_common.c | 8 ++++++++
John W. Linville 11cd48b
 1 file changed, 8 insertions(+)
John W. Linville 11cd48b
John W. Linville 11cd48b
diff --git a/src/eap_server/eap_server_tls_common.c b/src/eap_server/eap_server_tls_common.c
John W. Linville 11cd48b
index 31be2ec..46f282b 100644
John W. Linville 11cd48b
--- a/src/eap_server/eap_server_tls_common.c
John W. Linville 11cd48b
+++ b/src/eap_server/eap_server_tls_common.c
John W. Linville 0d84226
@@ -261,6 +261,14 @@
John W. Linville 11cd48b
 			return -1;
John W. Linville 11cd48b
 		}
John W. Linville 11cd48b
 
John W. Linville 11cd48b
+		if (len > message_length) {
John W. Linville 11cd48b
+			wpa_printf(MSG_INFO, "SSL: Too much data (%d bytes) in "
John W. Linville 11cd48b
+				   "first fragment of frame (TLS Message "
John W. Linville 11cd48b
+				   "Length %d bytes)",
John W. Linville 11cd48b
+				   (int) len, (int) message_length);
John W. Linville 11cd48b
+			return -1;
John W. Linville 11cd48b
+		}
John W. Linville 11cd48b
+
John W. Linville 11cd48b
 		data->tls_in = wpabuf_alloc(message_length);
John W. Linville 11cd48b
 		if (data->tls_in == NULL) {
John W. Linville 11cd48b
 			wpa_printf(MSG_DEBUG, "SSL: No memory for message");
John W. Linville 11cd48b
-- 
John W. Linville 11cd48b
1.7.11.4
John W. Linville 11cd48b