@@ -273,8 +273,14 @@ v0.995 (27-May-2014)
v0.996 (28-May-2014)
- Fix minor bug where SessionTicket message was printed as 'Unknown SSL3 code 4'
- Add EAP-TLS-specific options to pppd.8 manual page.
- - Updated README.eap-tls file with new option and provide an example.
+ - Updated README.eap-tls file with new options and provide an example.
v0.997 (19-Jun-2014)
- - change SSL_OP_NO_TICKETS to SSL_OP_NO_TICKET
- - fix bug in initialisation code with fragmented packets.
+ - Change SSL_OP_NO_TICKETS to SSL_OP_NO_TICKET
+ - Fix bug in initialisation code with fragmented packets.
+v0.998 (13-Mar-2015)
+ - Added fix for https://bugzilla.redhat.com/show_bug.cgi?id=1023620
+v0.999 (11-May-2017)
+ - Added support for OpenSSL 1.1: the code will now compile against OpenSSL 1.0.x or 1.1.x.
+v1.101 (1-Jun-2018)
+ - Fix vulnerabilities CVE-2018-11574.
@@ -62,6 +62,7 @@ static ENGINE *pkey_engine = NULL;
* tries to provide some guidance but ultimately falls short.
*/
+
static void HMAC_CTX_free(HMAC_CTX *ctx)
{
if (ctx != NULL) {
@@ -865,46 +866,47 @@ void eaptls_free_session(struct eaptls_session *ets)
int eaptls_receive(struct eaptls_session *ets, u_char * inp, int len)
{
u_char flags;
- u_int tlslen;
+ u_int tlslen = 0;
u_char dummy[65536];
+ if (len < 1) {
+ warn("EAP-TLS: received no or invalid data");
+ return 1;
+ }
+
GETCHAR(flags, inp);
len--;
- if (flags & EAP_TLS_FLAGS_LI && !ets->data) {
-
+ if (flags & EAP_TLS_FLAGS_LI && len >= 4) {
/*
- * This is the first packet of a message
+ * LenghtIncluded flag set -> this is the first packet of a message
*/
-
+
+ /*
+ * the first 4 octets are the length of the EAP-TLS message
+ */
GETLONG(tlslen, inp);
len -= 4;
- if (tlslen > EAP_TLS_MAX_LEN) {
- error("Error: tls message length > %d, truncated",
- EAP_TLS_MAX_LEN);
- tlslen = EAP_TLS_MAX_LEN;
- }
+ if (!ets->data) {
- /*
- * Allocate memory for the whole message
- */
- ets->data = malloc(tlslen);
- if (!ets->data)
- fatal("EAP TLS: allocation error\n");
+ if (tlslen > EAP_TLS_MAX_LEN) {
+ error("EAP-TLS: TLS message length > %d, truncated", EAP_TLS_MAX_LEN);
+ tlslen = EAP_TLS_MAX_LEN;
+ }
- ets->datalen = 0;
- ets->tlslen = tlslen;
+ /*
+ * Allocate memory for the whole message
+ */
+ ets->data = malloc(tlslen);
+ if (!ets->data)
+ fatal("EAP-TLS: allocation error\n");
- }
- else if (flags & EAP_TLS_FLAGS_LI && ets->data) {
- /*
- * Non first with LI (strange...)
- */
-
- GETLONG(tlslen, inp);
- len -= 4;
-
+ ets->datalen = 0;
+ ets->tlslen = tlslen;
+ }
+ else
+ warn("EAP-TLS: non-first LI packet? that's odd...");
}
else if (!ets->data) {
/*
@@ -913,7 +915,7 @@ int eaptls_receive(struct eaptls_session *ets, u_char * inp, int len)
ets->data = malloc(len);
if (!ets->data)
- fatal("EAP TLS: allocation error\n");
+ fatal("EAP-TLS: allocation error\n");
ets->datalen = 0;
ets->tlslen = len;
@@ -924,8 +926,13 @@ int eaptls_receive(struct eaptls_session *ets, u_char * inp, int len)
else
ets->frag = 0;
+ if (len < 0) {
+ warn("EAP-TLS: received malformed data");
+ return 1;
+ }
+
if (len + ets->datalen > ets->tlslen) {
- warn("EAP TLS: received data > TLS message length");
+ warn("EAP-TLS: received data > TLS message length");
return 1;
}
@@ -939,7 +946,7 @@ int eaptls_receive(struct eaptls_session *ets, u_char * inp, int len)
*/
if (ets->datalen != ets->tlslen) {
- warn("EAP TLS: received data != TLS message length");
+ warn("EAP-TLS: received data != TLS message length");
return 1;
}
@@ -1200,7 +1207,6 @@ ssl_msg_callback(int write_p, int version, int content_type,
switch(content_type) {
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L
case SSL3_RT_HEADER:
strcat(string, "SSL/TLS Header: ");
switch(hvers) {
@@ -1226,7 +1232,6 @@ ssl_msg_callback(int write_p, int version, int content_type,
strcat(string, "Unknown version");
}
break;
-#endif /* OPENSSL_VERSION_NUMBER >= 0x10100000L */
case SSL3_RT_ALERT:
strcat(string, "Alert: ");
@@ -1703,6 +1703,11 @@ int len;
case eapListen:
+ if (len < 1) {
+ error("EAP: received EAP-TLS Listen packet with no data");
+ /* Bogus request; wait for something real. */
+ return;
+ }
GETCHAR(flags, inp);
if(flags & EAP_TLS_FLAGS_START){
@@ -1740,6 +1745,11 @@ int len;
break;
case eapTlsRecv:
+ if (len < 1) {
+ error("EAP: discarding EAP-TLS Receive packet with no data");
+ /* Bogus request; wait for something real. */
+ return;
+ }
eaptls_receive(ets, inp, len);
if(ets->frag) {
@@ -2110,6 +2120,7 @@ int len;
switch(esp->es_server.ea_state) {
case eapTlsRecv:
+
ets = (struct eaptls_session *) esp->es_server.ea_session;
eap_figure_next_state(esp,
eaptls_receive(esp->es_server.ea_session, inp, len));
@@ -2130,19 +2141,22 @@ int len;
case eapTlsRecvClient:
/* Receive authentication response from client */
- GETCHAR(flags, inp);
+ if (len > 0) {
+ GETCHAR(flags, inp);
- if(len == 1 && !flags) { /* Ack = ok */
+ if(len == 1 && !flags) { /* Ack = ok */
#ifdef MPPE
- eaptls_gen_mppe_keys( esp->es_server.ea_session, "client EAP encryption", 0 );
+ eaptls_gen_mppe_keys( esp->es_server.ea_session, "client EAP encryption", 0 );
#endif
- eap_send_success(esp);
- }
- else { /* failure */
- eaptls_receive(esp->es_server.ea_session, inp, len);
- warn("Server authentication failed");
- eap_send_failure(esp);
+ eap_send_success(esp);
+ }
+ else { /* failure */
+ warn("Server authentication failed");
+ eap_send_failure(esp);
+ }
}
+ else
+ warn("Bogus EAP-TLS packet received from client");
eaptls_free_session(esp->es_server.ea_session);