Date: Sat, 30 Jan 2016 06:12:03 +0000 (UTC) From: Xin LI <delphij@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r295061 - in releng: 10.1 10.1/crypto/openssl/ssl 10.1/sys/conf 10.2 10.2/crypto/openssl/ssl 10.2/sys/conf 9.3 9.3/crypto/openssl/ssl 9.3/sys/conf Message-ID: <201601300612.u0U6C3ti004814@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: delphij Date: Sat Jan 30 06:12:03 2016 New Revision: 295061 URL: https://svnweb.freebsd.org/changeset/base/295061 Log: Fix OpenSSL SSLv2 ciphersuite downgrade vulnerability. Security: CVE-2015-3197 Security: FreeBSD-SA-16:11.openssl Approved by: so Modified: releng/10.1/UPDATING releng/10.1/crypto/openssl/ssl/s2_srvr.c releng/10.1/sys/conf/newvers.sh releng/10.2/UPDATING releng/10.2/crypto/openssl/ssl/s2_srvr.c releng/10.2/sys/conf/newvers.sh releng/9.3/UPDATING releng/9.3/crypto/openssl/ssl/s2_srvr.c releng/9.3/sys/conf/newvers.sh Modified: releng/10.1/UPDATING ============================================================================== --- releng/10.1/UPDATING Sat Jan 30 06:09:38 2016 (r295060) +++ releng/10.1/UPDATING Sat Jan 30 06:12:03 2016 (r295061) @@ -16,6 +16,10 @@ from older versions of FreeBSD, try WITH stable/10, and then rebuild without this option. The bootstrap process from older version of current is a bit fragile. +20160130 p29 FreeBSD-SA-16:11.openssl + + Fix OpenSSL SSLv2 ciphersuite downgrade vulnerability. [SA-16:11] + 20160127 p28 FreeBSD-SA-16:09.ntp FreeBSD-SA-16:10.linux Modified: releng/10.1/crypto/openssl/ssl/s2_srvr.c ============================================================================== --- releng/10.1/crypto/openssl/ssl/s2_srvr.c Sat Jan 30 06:09:38 2016 (r295060) +++ releng/10.1/crypto/openssl/ssl/s2_srvr.c Sat Jan 30 06:12:03 2016 (r295061) @@ -400,7 +400,7 @@ static int get_client_master_key(SSL *s) } cp=ssl2_get_cipher_by_char(p); - if (cp == NULL) + if (cp == NULL || sk_SSL_CIPHER_find(s->session->ciphers, cp) < 0) { ssl2_return_error(s,SSL2_PE_NO_CIPHER); SSLerr(SSL_F_GET_CLIENT_MASTER_KEY, SSL_R_NO_CIPHER_MATCH); @@ -698,9 +698,12 @@ static int get_client_hello(SSL *s) prio = cs; allow = cl; } - for (z=0; z<sk_SSL_CIPHER_num(prio); z++) + /* Generate list of SSLv2 ciphers shared between client and server */ + for (z = 0; z < sk_SSL_CIPHER_num(prio); z++) { - if (sk_SSL_CIPHER_find(allow,sk_SSL_CIPHER_value(prio,z)) < 0) + const SSL_CIPHER *cp = sk_SSL_CIPHER_value(prio, z); + if ((cp->algorithm_ssl & SSL_SSLV2) == 0 || + sk_SSL_CIPHER_find(allow, cp) < 0) { (void)sk_SSL_CIPHER_delete(prio,z); z--; @@ -711,6 +714,14 @@ static int get_client_hello(SSL *s) sk_SSL_CIPHER_free(s->session->ciphers); s->session->ciphers = prio; } + + /* Make sure we have at least one cipher in common */ + if (sk_SSL_CIPHER_num(s->session->ciphers) == 0) + { + ssl2_return_error(s, SSL2_PE_NO_CIPHER); + SSLerr(SSL_F_GET_CLIENT_HELLO, SSL_R_NO_CIPHER_MATCH); + return -1; + } /* s->session->ciphers should now have a list of * ciphers that are on both the client and server. * This list is ordered by the order the client sent Modified: releng/10.1/sys/conf/newvers.sh ============================================================================== --- releng/10.1/sys/conf/newvers.sh Sat Jan 30 06:09:38 2016 (r295060) +++ releng/10.1/sys/conf/newvers.sh Sat Jan 30 06:12:03 2016 (r295061) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="10.1" -BRANCH="RELEASE-p28" +BRANCH="RELEASE-p29" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/10.2/UPDATING ============================================================================== --- releng/10.2/UPDATING Sat Jan 30 06:09:38 2016 (r295060) +++ releng/10.2/UPDATING Sat Jan 30 06:12:03 2016 (r295061) @@ -16,6 +16,10 @@ from older versions of FreeBSD, try WITH stable/10, and then rebuild without this option. The bootstrap process from older version of current is a bit fragile. +20160130 p12 FreeBSD-SA-16:11.openssl + + Fix OpenSSL SSLv2 ciphersuite downgrade vulnerability. [SA-16:11] + 20160127 p11 FreeBSD-SA-16:09.ntp FreeBSD-SA-16:10.linux Modified: releng/10.2/crypto/openssl/ssl/s2_srvr.c ============================================================================== --- releng/10.2/crypto/openssl/ssl/s2_srvr.c Sat Jan 30 06:09:38 2016 (r295060) +++ releng/10.2/crypto/openssl/ssl/s2_srvr.c Sat Jan 30 06:12:03 2016 (r295061) @@ -402,7 +402,7 @@ static int get_client_master_key(SSL *s) } cp = ssl2_get_cipher_by_char(p); - if (cp == NULL) { + if (cp == NULL || sk_SSL_CIPHER_find(s->session->ciphers, cp) < 0) { ssl2_return_error(s, SSL2_PE_NO_CIPHER); SSLerr(SSL_F_GET_CLIENT_MASTER_KEY, SSL_R_NO_CIPHER_MATCH); return (-1); @@ -687,8 +687,12 @@ static int get_client_hello(SSL *s) prio = cs; allow = cl; } + + /* Generate list of SSLv2 ciphers shared between client and server */ for (z = 0; z < sk_SSL_CIPHER_num(prio); z++) { - if (sk_SSL_CIPHER_find(allow, sk_SSL_CIPHER_value(prio, z)) < 0) { + const SSL_CIPHER *cp = sk_SSL_CIPHER_value(prio, z); + if ((cp->algorithm_ssl & SSL_SSLV2) == 0 || + sk_SSL_CIPHER_find(allow, cp) < 0) { (void)sk_SSL_CIPHER_delete(prio, z); z--; } @@ -697,6 +701,13 @@ static int get_client_hello(SSL *s) sk_SSL_CIPHER_free(s->session->ciphers); s->session->ciphers = prio; } + + /* Make sure we have at least one cipher in common */ + if (sk_SSL_CIPHER_num(s->session->ciphers) == 0) { + ssl2_return_error(s, SSL2_PE_NO_CIPHER); + SSLerr(SSL_F_GET_CLIENT_HELLO, SSL_R_NO_CIPHER_MATCH); + return -1; + } /* * s->session->ciphers should now have a list of ciphers that are on * both the client and server. This list is ordered by the order the Modified: releng/10.2/sys/conf/newvers.sh ============================================================================== --- releng/10.2/sys/conf/newvers.sh Sat Jan 30 06:09:38 2016 (r295060) +++ releng/10.2/sys/conf/newvers.sh Sat Jan 30 06:12:03 2016 (r295061) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="10.2" -BRANCH="RELEASE-p11" +BRANCH="RELEASE-p12" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/9.3/UPDATING ============================================================================== --- releng/9.3/UPDATING Sat Jan 30 06:09:38 2016 (r295060) +++ releng/9.3/UPDATING Sat Jan 30 06:12:03 2016 (r295061) @@ -11,6 +11,10 @@ handbook: Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before running portupgrade. +20160130 p36 FreeBSD-SA-16:11.openssl + + Fix OpenSSL SSLv2 ciphersuite downgrade vulnerability. [SA-16:11] + 20160127 p35 FreeBSD-SA-16:08.bind FreeBSD-SA-16:09.ntp FreeBSD-SA-16:10.linux Modified: releng/9.3/crypto/openssl/ssl/s2_srvr.c ============================================================================== --- releng/9.3/crypto/openssl/ssl/s2_srvr.c Sat Jan 30 06:09:38 2016 (r295060) +++ releng/9.3/crypto/openssl/ssl/s2_srvr.c Sat Jan 30 06:12:03 2016 (r295061) @@ -392,7 +392,7 @@ static int get_client_master_key(SSL *s) } cp=ssl2_get_cipher_by_char(p); - if (cp == NULL) + if (cp == NULL || sk_SSL_CIPHER_find(s->session->ciphers, cp) < 0) { ssl2_return_error(s,SSL2_PE_NO_CIPHER); SSLerr(SSL_F_GET_CLIENT_MASTER_KEY, SSL_R_NO_CIPHER_MATCH); @@ -690,9 +690,12 @@ static int get_client_hello(SSL *s) prio = cs; allow = cl; } - for (z=0; z<sk_SSL_CIPHER_num(prio); z++) + /* Generate list of SSLv2 ciphers shared between client and server */ + for (z = 0; z < sk_SSL_CIPHER_num(prio); z++) { - if (sk_SSL_CIPHER_find(allow,sk_SSL_CIPHER_value(prio,z)) < 0) + const SSL_CIPHER *cp = sk_SSL_CIPHER_value(prio, z); + if ((cp->algorithms & SSL_SSLV2) == 0 || + sk_SSL_CIPHER_find(allow, cp) < 0) { (void)sk_SSL_CIPHER_delete(prio,z); z--; @@ -703,6 +706,14 @@ static int get_client_hello(SSL *s) sk_SSL_CIPHER_free(s->session->ciphers); s->session->ciphers = prio; } + + /* Make sure we have at least one cipher in common */ + if (sk_SSL_CIPHER_num(s->session->ciphers) == 0) + { + ssl2_return_error(s, SSL2_PE_NO_CIPHER); + SSLerr(SSL_F_GET_CLIENT_HELLO, SSL_R_NO_CIPHER_MATCH); + return -1; + } /* s->session->ciphers should now have a list of * ciphers that are on both the client and server. * This list is ordered by the order the client sent Modified: releng/9.3/sys/conf/newvers.sh ============================================================================== --- releng/9.3/sys/conf/newvers.sh Sat Jan 30 06:09:38 2016 (r295060) +++ releng/9.3/sys/conf/newvers.sh Sat Jan 30 06:12:03 2016 (r295061) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="9.3" -BRANCH="RELEASE-p35" +BRANCH="RELEASE-p36" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601300612.u0U6C3ti004814>