From f711b5a0d81adbf06ca759217aad01e7eade9fac Mon Sep 17 00:00:00 2001 From: Andy Lau Date: Sun, 29 Jun 2025 06:55:40 +0000 Subject: [PATCH] fix CVE-2025-5987 --- ...-Correctly-detect-failures-of-chacha.patch | 30 +++++++++++++++++++ libssh.spec | 9 +++++- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 backport-0020-CVE-2025-5987-Correctly-detect-failures-of-chacha.patch diff --git a/backport-0020-CVE-2025-5987-Correctly-detect-failures-of-chacha.patch b/backport-0020-CVE-2025-5987-Correctly-detect-failures-of-chacha.patch new file mode 100644 index 0000000..8368db0 --- /dev/null +++ b/backport-0020-CVE-2025-5987-Correctly-detect-failures-of-chacha.patch @@ -0,0 +1,30 @@ +From 90b4845e0c98574bbf7bea9e97796695f064bf57 Mon Sep 17 00:00:00 2001 +From: Jakub Jelen +Date: Tue, 6 May 2025 22:51:41 +0200 +Subject: CVE-2025-5987 libcrypto: Correctly detect failures of chacha initialization + +Signed-off-by: Jakub Jelen +Reviewed-by: Andreas Schneider +--- + src/libcrypto.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/libcrypto.c b/src/libcrypto.c +index 4f945d9..911b363 100644 +--- a/src/libcrypto.c ++++ b/src/libcrypto.c +@@ -777,9 +777,9 @@ chacha20_poly1305_set_key(struct ssh_cipher_struct *cipher, + SSH_LOG(SSH_LOG_WARNING, "EVP_CIPHER_CTX_new failed"); + goto out; + } +- ret = EVP_EncryptInit_ex(ctx->header_evp, EVP_chacha20(), NULL, ++ rv = EVP_EncryptInit_ex(ctx->header_evp, EVP_chacha20(), NULL, + u8key + CHACHA20_KEYLEN, NULL); +- if (ret != 1) { ++ if (rv != 1) { + SSH_LOG(SSH_LOG_WARNING, "EVP_CipherInit failed"); + goto out; + } +-- +2.43.0 + diff --git a/libssh.spec b/libssh.spec index ab686c6..065a986 100644 --- a/libssh.spec +++ b/libssh.spec @@ -2,7 +2,7 @@ Name: libssh Version: 0.10.5 -Release: 4 +Release: 6 Summary: A library implementing the SSH protocol License: LGPL-2.1-or-later URL: https://www.libssh.org @@ -31,6 +31,7 @@ Patch17: backport-0017-CVE-2023-6918-Systematically-check-return-values-w Patch18: backport-0018-CVE-2023-6918-kdf-Detect-context-init-failures.patch Patch19: backport-0019-CVE-2023-6918-tests-Code-coverage-for-ssh_get_pubkey.patch Patch20: backport-Fix-regression-in-IPv6-addresses-in-hostname-parsing.patch +Patch22: backport-0020-CVE-2025-5987-Correctly-detect-failures-of-chacha.patch BuildRequires: cmake gcc-c++ gnupg2 openssl-devel pkgconfig zlib-devel BuildRequires: krb5-devel libcmocka-devel openssh-clients openssh-server @@ -102,6 +103,12 @@ popd %doc CHANGELOG README %changelog +* Sun Jun 29 2025 andy - 0.10.5-6 +- Type:CVE +- Id:CVE-2025-5987 +- SUG:NA +- DESC:fix CVE-2025-5987 + * Tue Nov 19 2024 Funda Wang - 0.10.5-4 - adopt to new cmake macro -- Gitee