summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support
diff options
context:
space:
mode:
authorVijay Anusuri <vanusuri@mvista.com>2025-10-30 12:40:58 +0530
committerAnuj Mittal <anuj.mittal@oss.qualcomm.com>2025-11-12 10:44:37 +0530
commitf6e28410805d2d2e84aa37bf07360370f03d85a8 (patch)
treeeb470d900cc45e6f209cb3ae0112057aaa6a96be /meta-oe/recipes-support
parent34093c56ae631734eeecf80803d5cf5913d94ffc (diff)
downloadmeta-openembedded-f6e28410805d2d2e84aa37bf07360370f03d85a8.tar.gz
libssh: Fix CVE-2025-8277
Upstream-Commits: https://git.libssh.org/projects/libssh.git/commit/?h=stable-0.11&id=87db2659ec608a977a63eea529f17b9168388d73 & https://git.libssh.org/projects/libssh.git/commit/?h=stable-0.11&id=266174a6d36687b65cf90174f06af90b8b27c65f & https://git.libssh.org/projects/libssh.git/commit/?h=stable-0.11&id=8e4d67aa9eda455bfad9ac610e54b7a548d0aa08 & https://git.libssh.org/projects/libssh.git/commit/?h=stable-0.11&id=1c763e29d138db87665e98983f468d2dd0f286c1 The changes made to the file src/ecdh_crypto.c are excluded, present in the commit 266174a6d36687b65cf90174f06af90b8b27c65. The relevant changes in `ecdh_crypto.c` are located within the function `static ssh_string ssh_ecdh_generate`. This function, however, is not present in the `libssh-0.10.6` version. It was introduced in `libssh` version 0.11 by the commit `https://git.libssh.org/projects/libssh.git/commit/src/ecdh_crypto.c?h=stable-0.11&id=1eb3df5254a4348eae6edbc8a2bf08fef4015897`. Consequently, these changes cannot be directly applied to the `libssh-0.10.6` version. This aligns with the approach taken by other distributions, as Suse also did not backport the `ecdh_crypto.c` file changes in their `libssh-0.10.6-3.1.src.rpm` package, which is available at `https://cdimage.debian.org/mirror/opensuse.org/distribution/leap-micro/6.0/product/repo/openSUSE-Leap-Micro-6.0-x86_64-Media3/src/libssh-0.10.6-3.1.src.rpm`. Signed-off-by: Vijay Anusuri <vanusuri@mvista.com> Signed-off-by: Anuj Mittal <anuj.mittal@oss.qualcomm.com>
Diffstat (limited to 'meta-oe/recipes-support')
-rw-r--r--meta-oe/recipes-support/libssh/libssh/CVE-2025-8277-1.patch40
-rw-r--r--meta-oe/recipes-support/libssh/libssh/CVE-2025-8277-2.patch94
-rw-r--r--meta-oe/recipes-support/libssh/libssh/CVE-2025-8277-3.patch48
-rw-r--r--meta-oe/recipes-support/libssh/libssh/CVE-2025-8277-4.patch48
-rw-r--r--meta-oe/recipes-support/libssh/libssh_0.10.6.bb4
5 files changed, 234 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/libssh/libssh/CVE-2025-8277-1.patch b/meta-oe/recipes-support/libssh/libssh/CVE-2025-8277-1.patch
new file mode 100644
index 0000000000..7155618271
--- /dev/null
+++ b/meta-oe/recipes-support/libssh/libssh/CVE-2025-8277-1.patch
@@ -0,0 +1,40 @@
1From 87db2659ec608a977a63eea529f17b9168388d73 Mon Sep 17 00:00:00 2001
2From: Jakub Jelen <jjelen@redhat.com>
3Date: Tue, 5 Aug 2025 18:42:31 +0200
4Subject: CVE-2025-8277: packet: Adjust packet filter to work when DH-GEX is
5 guessed wrongly
6
7Signed-off-by: Jakub Jelen <jjelen@redhat.com>
8Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
9(cherry picked from commit 4310a696f2d632c6742678077d703d9b9ff3bc0e)
10
11Upstream-Status: Backport [https://git.libssh.org/projects/libssh.git/commit/?h=stable-0.11&id=87db2659ec608a977a63eea529f17b9168388d73]
12CVE: CVE-2025-8277
13Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
14---
15 src/packet.c | 2 ++
16 1 file changed, 2 insertions(+)
17
18diff --git a/src/packet.c b/src/packet.c
19index f15aa2ad..f54b3158 100644
20--- a/src/packet.c
21+++ b/src/packet.c
22@@ -294,6 +294,7 @@ static enum ssh_packet_filter_result_e ssh_packet_incoming_filter(ssh_session se
23 * or session_state == SSH_SESSION_STATE_INITIAL_KEX
24 * - dh_handshake_state == DH_STATE_INIT
25 * or dh_handshake_state == DH_STATE_INIT_SENT (re-exchange)
26+ * or dh_handshake_state == DH_STATE_REQUEST_SENT (dh-gex)
27 * or dh_handshake_state == DH_STATE_FINISHED (re-exchange)
28 *
29 * Transitions:
30@@ -313,6 +314,7 @@ static enum ssh_packet_filter_result_e ssh_packet_incoming_filter(ssh_session se
31
32 if ((session->dh_handshake_state != DH_STATE_INIT) &&
33 (session->dh_handshake_state != DH_STATE_INIT_SENT) &&
34+ (session->dh_handshake_state != DH_STATE_REQUEST_SENT) &&
35 (session->dh_handshake_state != DH_STATE_FINISHED))
36 {
37 rc = SSH_PACKET_DENIED;
38--
39cgit v1.2.3
40
diff --git a/meta-oe/recipes-support/libssh/libssh/CVE-2025-8277-2.patch b/meta-oe/recipes-support/libssh/libssh/CVE-2025-8277-2.patch
new file mode 100644
index 0000000000..748d390d63
--- /dev/null
+++ b/meta-oe/recipes-support/libssh/libssh/CVE-2025-8277-2.patch
@@ -0,0 +1,94 @@
1From 266174a6d36687b65cf90174f06af90b8b27c65f Mon Sep 17 00:00:00 2001
2From: Francesco Rollo <eferollo@gmail.com>
3Date: Thu, 24 Jul 2025 16:30:07 +0300
4Subject: [PATCH] CVE-2025-8277: Fix memory leak of unused ephemeral key pair
5 after client's wrong KEX guess
6
7Signed-off-by: Francesco Rollo <eferollo@gmail.com>
8Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
9(cherry picked from commit ccff22d3787c1355b3f0dcd09fe54d90acc55bf1)
10
11Changes in file 'src/ecdh_crypto.c' excluded.
12The relevant changes in `ecdh_crypto.c` are located within the function `static ssh_string ssh_ecdh_generate`. This function, however, is not present in the `libssh-0.10.6` version. It was introduced in `libssh` version 0.11 by the commit `https://git.libssh.org/projects/libssh.git/commit/src/ecdh_crypto.c?h=stable-0.11&id=1eb3df5254a4348eae6edbc8a2bf08fef4015897`.
13
14Consequently, these changes cannot be directly applied to the `libssh-0.10.6` version. This aligns with the approach taken by other distributions, as Suse also did not backport the `ecdh_crypto.c` file changes in their `libssh-0.10.6-3.1.src.rpm` package, which is available at `https://cdimage.debian.org/mirror/opensuse.org/distribution/leap-micro/6.0/product/repo/openSUSE-Leap-Micro-6.0-x86_64-Media3/src/libssh-0.10.6-3.1.src.rpm`.
15
16Upstream-Status: Backport [https://git.libssh.org/projects/libssh.git/commit/?h=stable-0.11&id=266174a6d36687b65cf90174f06af90b8b27c65f]
17CVE: CVE-2025-8277
18Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
19---
20 src/dh_crypto.c | 5 +++++
21 src/dh_key.c | 5 +++++
22 src/ecdh_gcrypt.c | 6 ++++++
23 src/ecdh_mbedcrypto.c | 6 ++++++
24 4 files changed, 22 insertions(+)
25
26diff --git a/src/dh_crypto.c b/src/dh_crypto.c
27index 4dd9b507..cedfbc81 100644
28--- a/src/dh_crypto.c
29+++ b/src/dh_crypto.c
30@@ -407,6 +407,11 @@ int ssh_dh_init_common(struct ssh_crypto_struct *crypto)
31 struct dh_ctx *ctx = NULL;
32 int rc;
33
34+ /* Cleanup any previously allocated dh_ctx */
35+ if (crypto->dh_ctx != NULL) {
36+ ssh_dh_cleanup(crypto);
37+ }
38+
39 ctx = calloc(1, sizeof(*ctx));
40 if (ctx == NULL) {
41 return SSH_ERROR;
42diff --git a/src/dh_key.c b/src/dh_key.c
43index 20d24a31..d9743ceb 100644
44--- a/src/dh_key.c
45+++ b/src/dh_key.c
46@@ -237,6 +237,11 @@ int ssh_dh_init_common(struct ssh_crypto_struct *crypto)
47 struct dh_ctx *ctx = NULL;
48 int rc;
49
50+ /* Cleanup any previously allocated dh_ctx */
51+ if (crypto->dh_ctx != NULL) {
52+ ssh_dh_cleanup(crypto);
53+ }
54+
55 ctx = calloc(1, sizeof(*ctx));
56 if (ctx == NULL) {
57 return SSH_ERROR;
58diff --git a/src/ecdh_gcrypt.c b/src/ecdh_gcrypt.c
59index 73fcd50f..b8d983c1 100644
60--- a/src/ecdh_gcrypt.c
61+++ b/src/ecdh_gcrypt.c
62@@ -101,6 +101,12 @@ int ssh_client_ecdh_init(ssh_session session)
63 goto out;
64 }
65
66+ /* Free any previously allocated privkey */
67+ if (session->next_crypto->ecdh_privkey != NULL) {
68+ gcry_sexp_release(session->next_crypto->ecdh_privkey);
69+ session->next_crypto->ecdh_privkey = NULL;
70+ }
71+
72 session->next_crypto->ecdh_privkey = key;
73 key = NULL;
74 session->next_crypto->ecdh_client_pubkey = client_pubkey;
75diff --git a/src/ecdh_mbedcrypto.c b/src/ecdh_mbedcrypto.c
76index dda73922..6074b93d 100644
77--- a/src/ecdh_mbedcrypto.c
78+++ b/src/ecdh_mbedcrypto.c
79@@ -70,6 +70,12 @@ int ssh_client_ecdh_init(ssh_session session)
80 return SSH_ERROR;
81 }
82
83+ /* Free any previously allocated privkey */
84+ if (session->next_crypto->ecdh_privkey != NULL) {
85+ mbedtls_ecp_keypair_free(session->next_crypto->ecdh_privkey);
86+ SAFE_FREE(session->next_crypto->ecdh_privkey);
87+ }
88+
89 session->next_crypto->ecdh_privkey = malloc(sizeof(mbedtls_ecp_keypair));
90 if (session->next_crypto->ecdh_privkey == NULL) {
91 return SSH_ERROR;
92--
932.25.1
94
diff --git a/meta-oe/recipes-support/libssh/libssh/CVE-2025-8277-3.patch b/meta-oe/recipes-support/libssh/libssh/CVE-2025-8277-3.patch
new file mode 100644
index 0000000000..41848b1f0a
--- /dev/null
+++ b/meta-oe/recipes-support/libssh/libssh/CVE-2025-8277-3.patch
@@ -0,0 +1,48 @@
1From 8e4d67aa9eda455bfad9ac610e54b7a548d0aa08 Mon Sep 17 00:00:00 2001
2From: Jakub Jelen <jjelen@redhat.com>
3Date: Wed, 6 Aug 2025 11:10:38 +0200
4Subject: [PATCH] CVE-2025-8277: ecdh: Free previously allocated pubkeys
5
6Signed-off-by: Jakub Jelen <jjelen@redhat.com>
7Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
8(cherry picked from commit c9d95ab0c7a52b231bcec09afbea71944ed0d852)
9
10Upstream-Status: Backport [https://git.libssh.org/projects/libssh.git/commit/?h=stable-0.11&id=8e4d67aa9eda455bfad9ac610e54b7a548d0aa08]
11CVE: CVE-2025-8277
12Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
13---
14 src/ecdh_crypto.c | 1 +
15 src/ecdh_gcrypt.c | 3 ++-
16 2 files changed, 3 insertions(+), 1 deletion(-)
17
18diff --git a/src/ecdh_crypto.c b/src/ecdh_crypto.c
19index 069b1372..4a029db3 100644
20--- a/src/ecdh_crypto.c
21+++ b/src/ecdh_crypto.c
22@@ -220,6 +220,7 @@ int ssh_client_ecdh_init(ssh_session session){
23 }
24
25 session->next_crypto->ecdh_privkey = key;
26+ ssh_string_free(session->next_crypto->ecdh_client_pubkey);
27 session->next_crypto->ecdh_client_pubkey = client_pubkey;
28
29 /* register the packet callbacks */
30diff --git a/src/ecdh_gcrypt.c b/src/ecdh_gcrypt.c
31index b8d983c1..662497e3 100644
32--- a/src/ecdh_gcrypt.c
33+++ b/src/ecdh_gcrypt.c
34@@ -106,9 +106,10 @@ int ssh_client_ecdh_init(ssh_session session)
35 gcry_sexp_release(session->next_crypto->ecdh_privkey);
36 session->next_crypto->ecdh_privkey = NULL;
37 }
38-
39 session->next_crypto->ecdh_privkey = key;
40 key = NULL;
41+
42+ SSH_STRING_FREE(session->next_crypto->ecdh_client_pubkey);
43 session->next_crypto->ecdh_client_pubkey = client_pubkey;
44 client_pubkey = NULL;
45
46--
472.25.1
48
diff --git a/meta-oe/recipes-support/libssh/libssh/CVE-2025-8277-4.patch b/meta-oe/recipes-support/libssh/libssh/CVE-2025-8277-4.patch
new file mode 100644
index 0000000000..d5b43c4d0b
--- /dev/null
+++ b/meta-oe/recipes-support/libssh/libssh/CVE-2025-8277-4.patch
@@ -0,0 +1,48 @@
1From 1c763e29d138db87665e98983f468d2dd0f286c1 Mon Sep 17 00:00:00 2001
2From: Jakub Jelen <jjelen@redhat.com>
3Date: Wed, 6 Aug 2025 15:32:56 +0200
4Subject: [PATCH] CVE-2025-8277: mbedtls: Avoid leaking ecdh keys
5
6Signed-off-by: Jakub Jelen <jjelen@redhat.com>
7Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
8(cherry picked from commit ffed80f8c078122990a4eba2b275facd56dd43e0)
9
10Upstream-Status: Backport [https://git.libssh.org/projects/libssh.git/commit/?h=stable-0.11&id=1c763e29d138db87665e98983f468d2dd0f286c1]
11CVE: CVE-2025-8277
12Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
13---
14 src/ecdh_mbedcrypto.c | 1 +
15 src/wrapper.c | 5 ++++-
16 2 files changed, 5 insertions(+), 1 deletion(-)
17
18diff --git a/src/ecdh_mbedcrypto.c b/src/ecdh_mbedcrypto.c
19index 6074b93d..351aa655 100644
20--- a/src/ecdh_mbedcrypto.c
21+++ b/src/ecdh_mbedcrypto.c
22@@ -116,6 +116,7 @@ int ssh_client_ecdh_init(ssh_session session)
23 goto out;
24 }
25
26+ SSH_STRING_FREE(session->next_crypto->ecdh_client_pubkey);
27 session->next_crypto->ecdh_client_pubkey = client_pubkey;
28 client_pubkey = NULL;
29
30diff --git a/src/wrapper.c b/src/wrapper.c
31index 43bf2137..0397f96d 100644
32--- a/src/wrapper.c
33+++ b/src/wrapper.c
34@@ -193,7 +193,10 @@ void crypto_free(struct ssh_crypto_struct *crypto)
35 #endif
36 crypto->ecdh_privkey = NULL;
37 }
38-#endif
39+#elif defined HAVE_LIBMBEDCRYPTO
40+ mbedtls_ecp_keypair_free(crypto->ecdh_privkey);
41+ SAFE_FREE(crypto->ecdh_privkey);
42+#endif /* HAVE_LIBGCRYPT */
43 SAFE_FREE(crypto->dh_server_signature);
44 if (crypto->session_id != NULL) {
45 explicit_bzero(crypto->session_id, crypto->session_id_len);
46--
472.25.1
48
diff --git a/meta-oe/recipes-support/libssh/libssh_0.10.6.bb b/meta-oe/recipes-support/libssh/libssh_0.10.6.bb
index 602e01fce6..de37719b09 100644
--- a/meta-oe/recipes-support/libssh/libssh_0.10.6.bb
+++ b/meta-oe/recipes-support/libssh/libssh_0.10.6.bb
@@ -18,6 +18,10 @@ SRC_URI = "git://git.libssh.org/projects/libssh.git;protocol=https;branch=stable
18 file://CVE-2025-4878-0002.patch \ 18 file://CVE-2025-4878-0002.patch \
19 file://CVE-2025-5987.patch \ 19 file://CVE-2025-5987.patch \
20 file://CVE-2025-8114.patch \ 20 file://CVE-2025-8114.patch \
21 file://CVE-2025-8277-1.patch \
22 file://CVE-2025-8277-2.patch \
23 file://CVE-2025-8277-3.patch \
24 file://CVE-2025-8277-4.patch \
21 " 25 "
22SRCREV = "10e09e273f69e149389b3e0e5d44b8c221c2e7f6" 26SRCREV = "10e09e273f69e149389b3e0e5d44b8c221c2e7f6"
23 27