diff --git a/backport-CVE-2025-8114-NULL-pointer-dereference-after-allocate-fail.patch b/backport-CVE-2025-8114-NULL-pointer-dereference-after-allocate-fail.patch new file mode 100644 index 0000000000000000000000000000000000000000..a759e1614f942e6d554a6d825e420da17ceb336c --- /dev/null +++ b/backport-CVE-2025-8114-NULL-pointer-dereference-after-allocate-fail.patch @@ -0,0 +1,46 @@ +From 53ac23ded4cb2c5463f6c4cd1525331bd578812d Mon Sep 17 00:00:00 2001 +From: Andreas Schneider +Date: Wed, 6 Aug 2025 15:17:59 +0200 +Subject: CVE-2025-8114: Fix NULL pointer dereference after allocation failure + +Signed-off-by: Andreas Schneider +Reviewed-by: Jakub Jelen + +Conflict: NA +Reference:https://git.libssh.org/projects/libssh.git/patch/?id=53ac23ded4cb2c5463f6c4cd1525331bd578812d +--- + src/kex.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/kex.c b/src/kex.c +index ec5b5bc..5f18207 100644 +--- a/src/kex.c ++++ b/src/kex.c +@@ -1307,6 +1307,8 @@ int ssh_make_sessionid(ssh_session session) + ssh_log_hexdump("hash buffer", ssh_buffer_get(buf), ssh_buffer_get_len(buf)); + #endif + ++ /* Set rc for the following switch statement in case we goto error. */ ++ rc = SSH_ERROR; + switch (session->next_crypto->kex_type) { + case SSH_KEX_DH_GROUP1_SHA1: + case SSH_KEX_DH_GROUP14_SHA1: +@@ -1366,6 +1368,7 @@ int ssh_make_sessionid(ssh_session session) + session->next_crypto->secret_hash); + break; + } ++ + /* During the first kex, secret hash and session ID are equal. However, after + * a key re-exchange, a new secret hash is calculated. This hash will not replace + * but complement existing session id. +@@ -1374,6 +1377,7 @@ int ssh_make_sessionid(ssh_session session) + session->next_crypto->session_id = malloc(session->next_crypto->digest_len); + if (session->next_crypto->session_id == NULL) { + ssh_set_error_oom(session); ++ rc = SSH_ERROR; + goto error; + } + memcpy(session->next_crypto->session_id, session->next_crypto->secret_hash, +-- +2.33.0 + diff --git a/libssh.spec b/libssh.spec index 95a8444846d22b1bf4e55c517025c4bc9982d97a..dfc06f7e81a4f4bfbfaf3780e045519ce40cdae7 100644 --- a/libssh.spec +++ b/libssh.spec @@ -1,6 +1,6 @@ Name: libssh Version: 0.9.4 -Release: 11 +Release: 12 Summary: A library implementing the SSH protocol License: LGPLv2+ URL: http://www.libssh.org @@ -56,6 +56,7 @@ Patch44: backport-CVE-2025-4878-fix-uninitialized-variable-part1.patch Patch45: backport-CVE-2025-4878-fix-uninitialized-variable-part2.patch Patch46: backport-CVE-2025-5372-pre-Reformat-ssh_kdf.patch Patch47: backport-CVE-2025-5372-Simplify-error-checking-in-ssh_kdf.patch +Patch48: backport-CVE-2025-8114-NULL-pointer-dereference-after-allocate-fail.patch BuildRequires: cmake gcc-c++ gnupg2 openssl-devel pkgconfig zlib-devel BuildRequires: krb5-devel libcmocka-devel openssh-clients openssh-server @@ -140,6 +141,12 @@ popd %doc ChangeLog README %changelog +* Mon Sep 15 2025 zhangbinqin - 0.9.4-12 +- Type:CVE +- Id:CVE-2025-8114 +- SUG:NA +- DESC:fix CVE-2025-8114 + * Wed Aug 27 2025 gaihuiying - 0.9.4-11 - Type:CVE - CVE:CVE-2025-4877 CVE-2025-4878 CVE-2025-5372