Skip to content

Commit 83764a9

Browse files
snhensonmattcaswell
authored andcommitted
Fix SRP ciphersuite DoS vulnerability.
If a client attempted to use an SRP ciphersuite and it had not been set up correctly it would crash with a null pointer read. A malicious server could exploit this in a DoS attack. Thanks to Joonas Kuorilehto and Riku Hietamäki from Codenomicon for reporting this issue. CVE-2014-5139 Reviewed-by: Tim Hudson <tjh@openssl.org>
1 parent 86788e1 commit 83764a9

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Diff for: ssl/s3_clnt.c

+9
Original file line numberDiff line numberDiff line change
@@ -954,6 +954,15 @@ int ssl3_get_server_hello(SSL *s)
954954
SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_WRONG_CIPHER_RETURNED);
955955
goto f_err;
956956
}
957+
#ifndef OPENSSL_NO_SRP
958+
if (((c->algorithm_mkey & SSL_kSRP) || (c->algorithm_auth & SSL_aSRP)) &&
959+
!(s->srp_ctx.srp_Mask & SSL_kSRP))
960+
{
961+
al=SSL_AD_ILLEGAL_PARAMETER;
962+
SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_WRONG_CIPHER_RETURNED);
963+
goto f_err;
964+
}
965+
#endif /* OPENSSL_NO_SRP */
957966
p+=ssl_put_cipher_by_char(s,NULL,NULL);
958967

959968
sk=ssl_get_ciphers_by_id(s);

Diff for: ssl/ssl_lib.c

+5
Original file line numberDiff line numberDiff line change
@@ -1406,6 +1406,11 @@ int ssl_cipher_list_to_bytes(SSL *s,STACK_OF(SSL_CIPHER) *sk,unsigned char *p,
14061406
s->psk_client_callback == NULL)
14071407
continue;
14081408
#endif /* OPENSSL_NO_PSK */
1409+
#ifndef OPENSSL_NO_SRP
1410+
if (((c->algorithm_mkey & SSL_kSRP) || (c->algorithm_auth & SSL_aSRP)) &&
1411+
!(s->srp_ctx.srp_Mask & SSL_kSRP))
1412+
continue;
1413+
#endif /* OPENSSL_NO_SRP */
14091414
j = put_cb ? put_cb(c,p) : ssl_put_cipher_by_char(s,c,p);
14101415
p+=j;
14111416
}

0 commit comments

Comments
 (0)