Fix seg fault with 0 p val in SKE
If a client receives a ServerKeyExchange for an anon DH ciphersuite with the value of p set to 0 then a seg fault can occur. This commits adds a test to reject p, g and pub key parameters that have a 0 value (in accordance with RFC 5246) The security vulnerability only affects master and 1.0.2, but the fix is additionally applied to 1.0.1 for additional confidence. CVE-2015-1794 Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
This commit is contained in:

committed by
Matt Caswell

parent
5d786e9e2d
commit
ada57746b6
@@ -1699,6 +1699,12 @@ int ssl3_get_key_exchange(SSL *s)
|
||||
}
|
||||
p += i;
|
||||
|
||||
if (BN_is_zero(dh->p)) {
|
||||
SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, SSL_R_BAD_DH_P_VALUE);
|
||||
goto f_err;
|
||||
}
|
||||
|
||||
|
||||
if (2 > n - param_len) {
|
||||
SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, SSL_R_LENGTH_TOO_SHORT);
|
||||
goto f_err;
|
||||
@@ -1719,6 +1725,11 @@ int ssl3_get_key_exchange(SSL *s)
|
||||
}
|
||||
p += i;
|
||||
|
||||
if (BN_is_zero(dh->g)) {
|
||||
SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, SSL_R_BAD_DH_G_VALUE);
|
||||
goto f_err;
|
||||
}
|
||||
|
||||
if (2 > n - param_len) {
|
||||
SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, SSL_R_LENGTH_TOO_SHORT);
|
||||
goto f_err;
|
||||
@@ -1740,6 +1751,11 @@ int ssl3_get_key_exchange(SSL *s)
|
||||
p += i;
|
||||
n -= param_len;
|
||||
|
||||
if (BN_is_zero(dh->pub_key)) {
|
||||
SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, SSL_R_BAD_DH_PUB_KEY_VALUE);
|
||||
goto f_err;
|
||||
}
|
||||
|
||||
# ifndef OPENSSL_NO_RSA
|
||||
if (alg_a & SSL_aRSA)
|
||||
pkey =
|
||||
|
Reference in New Issue
Block a user