From b9d810e5aab169d33b4c2ccca0c910e9a8641271 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Mar 31 2016 23:03:49 +0000 Subject: import libssh-0.7.1-2.el7 --- diff --git a/SOURCES/libssh-CVE-2016-0739.patch b/SOURCES/libssh-CVE-2016-0739.patch new file mode 100644 index 0000000..ad5247c --- /dev/null +++ b/SOURCES/libssh-CVE-2016-0739.patch @@ -0,0 +1,68 @@ +From dc2eaa017fe77e53bd9f1d4327a480d9bfe6cc6a Mon Sep 17 00:00:00 2001 +From: Aris Adamantiadis +Date: Tue, 9 Feb 2016 15:09:27 +0100 +Subject: [PATCH] dh: fix CVE-2016-0739 + +Due to a byte/bit confusion, the DH secret was too short. This file was +completely reworked and will be commited in a future version. +--- + src/dh.c | 22 +++++++++++++++++----- + 1 file changed, 17 insertions(+), 5 deletions(-) + +diff --git a/src/dh.c b/src/dh.c +index e489a1d..d27b66e 100644 +--- a/src/dh.c ++++ b/src/dh.c +@@ -227,15 +227,21 @@ void ssh_crypto_finalize(void) { + } + + int dh_generate_x(ssh_session session) { ++ int keysize; ++ if (session->next_crypto->kex_type == SSH_KEX_DH_GROUP1_SHA1) { ++ keysize = 1023; ++ } else { ++ keysize = 2047; ++ } + session->next_crypto->x = bignum_new(); + if (session->next_crypto->x == NULL) { + return -1; + } + + #ifdef HAVE_LIBGCRYPT +- bignum_rand(session->next_crypto->x, 128); ++ bignum_rand(session->next_crypto->x, keysize); + #elif defined HAVE_LIBCRYPTO +- bignum_rand(session->next_crypto->x, 128, 0, -1); ++ bignum_rand(session->next_crypto->x, keysize, -1, 0); + #endif + + /* not harder than this */ +@@ -248,15 +254,21 @@ int dh_generate_x(ssh_session session) { + + /* used by server */ + int dh_generate_y(ssh_session session) { +- session->next_crypto->y = bignum_new(); ++ int keysize; ++ if (session->next_crypto->kex_type == SSH_KEX_DH_GROUP1_SHA1) { ++ keysize = 1023; ++ } else { ++ keysize = 2047; ++ } ++ session->next_crypto->y = bignum_new(); + if (session->next_crypto->y == NULL) { + return -1; + } + + #ifdef HAVE_LIBGCRYPT +- bignum_rand(session->next_crypto->y, 128); ++ bignum_rand(session->next_crypto->y, keysize); + #elif defined HAVE_LIBCRYPTO +- bignum_rand(session->next_crypto->y, 128, 0, -1); ++ bignum_rand(session->next_crypto->y, keysize, -1, 0); + #endif + + /* not harder than this */ +-- +2.7.1 + + diff --git a/SPECS/libssh.spec b/SPECS/libssh.spec index 0c257e7..f8e7090 100644 --- a/SPECS/libssh.spec +++ b/SPECS/libssh.spec @@ -2,7 +2,7 @@ Name: libssh Version: 0.7.1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: A library implementing the SSH protocol License: LGPLv2+ URL: http://www.libssh.org @@ -11,6 +11,8 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Source0: https://red.libssh.org/attachments/download/154/libssh-0.7.1.tar.xz +Patch1: libssh-CVE-2016-0739.patch + BuildRequires: cmake BuildRequires: doxygen BuildRequires: openssl-devel @@ -38,6 +40,7 @@ applications that use %{name}. %prep %setup -q +%patch1 -p1 # Remove examples, they are not packaged and do not build on EPEL 5 sed -i -e 's|add_subdirectory(examples)||g' CMakeLists.txt @@ -92,6 +95,9 @@ rm -rf %{buildroot} %{_libdir}/libssh_threads.so %changelog +* Mon Feb 22 2016 - Stef Walter - 0.7.1-2 +- Security fix for CVE-2016-0739 rhbz#1305971 + * Mon Jul 06 2015 - Stef Walter - 0.7.1-1 - Updated to 0.7.1 release rhbz#1239085