|
| 1 | +From 593fa4de0aee1cc61ed78446fd2a914846abf374 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Andreas Schneider < [email protected]> |
| 3 | +Date: Wed, 6 Aug 2025 15:17:59 +0200 |
| 4 | +Subject: [PATCH] CVE-2025-8114: Fix NULL pointer dereference after allocation |
| 5 | + failure |
| 6 | + |
| 7 | +Signed-off-by: Andreas Schneider < [email protected]> |
| 8 | +Reviewed-by: Jakub Jelen < [email protected]> |
| 9 | +Signed-off-by: Azure Linux Security Servicing Account < [email protected]> |
| 10 | +Upstream-reference: https://git.libssh.org/projects/libssh.git/patch/?id=53ac23ded4cb2c5463f6c4cd1525331bd578812d |
| 11 | +--- |
| 12 | + src/kex.c | 4 ++++ |
| 13 | + 1 file changed, 4 insertions(+) |
| 14 | + |
| 15 | +diff --git a/src/kex.c b/src/kex.c |
| 16 | +index ecfc012..e88908b 100644 |
| 17 | +--- a/src/kex.c |
| 18 | ++++ b/src/kex.c |
| 19 | +@@ -1391,6 +1391,8 @@ int ssh_make_sessionid(ssh_session session) |
| 20 | + ssh_log_hexdump("hash buffer", ssh_buffer_get(buf), ssh_buffer_get_len(buf)); |
| 21 | + #endif |
| 22 | + |
| 23 | ++ /* Set rc for the following switch statement in case we goto error. */ |
| 24 | ++ rc = SSH_ERROR; |
| 25 | + switch (session->next_crypto->kex_type) { |
| 26 | + case SSH_KEX_DH_GROUP1_SHA1: |
| 27 | + case SSH_KEX_DH_GROUP14_SHA1: |
| 28 | +@@ -1450,6 +1452,7 @@ int ssh_make_sessionid(ssh_session session) |
| 29 | + session->next_crypto->secret_hash); |
| 30 | + break; |
| 31 | + } |
| 32 | ++ |
| 33 | + /* During the first kex, secret hash and session ID are equal. However, after |
| 34 | + * a key re-exchange, a new secret hash is calculated. This hash will not replace |
| 35 | + * but complement existing session id. |
| 36 | +@@ -1458,6 +1461,7 @@ int ssh_make_sessionid(ssh_session session) |
| 37 | + session->next_crypto->session_id = malloc(session->next_crypto->digest_len); |
| 38 | + if (session->next_crypto->session_id == NULL) { |
| 39 | + ssh_set_error_oom(session); |
| 40 | ++ rc = SSH_ERROR; |
| 41 | + goto error; |
| 42 | + } |
| 43 | + memcpy(session->next_crypto->session_id, session->next_crypto->secret_hash, |
| 44 | +-- |
| 45 | +2.45.4 |
| 46 | + |
0 commit comments