lkundrak / rpms / hostapd

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