CVE-2012-4445.patch 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. From: Jouni Malinen <j@w1.fi>
  2. Date: Sun, 7 Oct 2012 17:06:29 +0000 (+0300)
  3. Subject: EAP-TLS server: Fix TLS Message Length validation
  4. X-Git-Url: http://w1.fi/gitweb/gitweb.cgi?p=hostap.git;a=commitdiff_plain;h=586c446e0ff42ae00315b014924ec669023bd8de
  5. EAP-TLS server: Fix TLS Message Length validation
  6. EAP-TLS/PEAP/TTLS/FAST server implementation did not validate TLS
  7. Message Length value properly and could end up trying to store more
  8. information into the message buffer than the allocated size if the first
  9. fragment is longer than the indicated size. This could result in hostapd
  10. process terminating in wpabuf length validation. Fix this by rejecting
  11. messages that have invalid TLS Message Length value.
  12. This would affect cases that use the internal EAP authentication server
  13. in hostapd either directly with IEEE 802.1X or when using hostapd as a
  14. RADIUS authentication server and when receiving an incorrectly
  15. constructed EAP-TLS message. Cases where hostapd uses an external
  16. authentication are not affected.
  17. Thanks to Timo Warns for finding and reporting this issue.
  18. Signed-hostap: Jouni Malinen <j@w1.fi>
  19. intended-for: hostap-1
  20. ---
  21. diff --git a/src/eap_server/eap_server_tls_common.c b/src/eap_server/eap_server_tls_common.c
  22. index 31be2ec..46f282b 100644
  23. --- a/src/eap_server/eap_server_tls_common.c
  24. +++ b/src/eap_server/eap_server_tls_common.c
  25. @@ -228,6 +228,14 @@ static int eap_server_tls_process_fragment(struct eap_ssl_data *data,
  26. return -1;
  27. }
  28. + if (len > message_length) {
  29. + wpa_printf(MSG_INFO, "SSL: Too much data (%d bytes) in "
  30. + "first fragment of frame (TLS Message "
  31. + "Length %d bytes)",
  32. + (int) len, (int) message_length);
  33. + return -1;
  34. + }
  35. +
  36. data->tls_in = wpabuf_alloc(message_length);
  37. if (data->tls_in == NULL) {
  38. wpa_printf(MSG_DEBUG, "SSL: No memory for message");