summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support/libssh
diff options
context:
space:
mode:
authorVijay Anusuri <vanusuri@mvista.com>2026-03-11 13:07:51 +0530
committerAnuj Mittal <anuj.mittal@oss.qualcomm.com>2026-03-24 08:52:09 +0530
commit59b94e41bf969076da983306a388a56cfb51bc7e (patch)
tree25045be586ab1cbcaf3d22ea8d88159e0e5fc0bb /meta-oe/recipes-support/libssh
parenta88f173ed01b76697b0e2ad22bfd3615cb19b411 (diff)
downloadmeta-openembedded-59b94e41bf969076da983306a388a56cfb51bc7e.tar.gz
libssh: Fix CVE-2026-3731
Pick commits according to [1] [1] https://security-tracker.debian.org/tracker/CVE-2026-3731 [2] https://www.libssh.org/security/advisories/libssh-2026-sftp-extensions.txt 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/libssh')
-rw-r--r--meta-oe/recipes-support/libssh/libssh/CVE-2026-3731-1.patch44
-rw-r--r--meta-oe/recipes-support/libssh/libssh/CVE-2026-3731-2.patch102
-rw-r--r--meta-oe/recipes-support/libssh/libssh_0.10.6.bb2
3 files changed, 148 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/libssh/libssh/CVE-2026-3731-1.patch b/meta-oe/recipes-support/libssh/libssh/CVE-2026-3731-1.patch
new file mode 100644
index 0000000000..69a012d294
--- /dev/null
+++ b/meta-oe/recipes-support/libssh/libssh/CVE-2026-3731-1.patch
@@ -0,0 +1,44 @@
1From f80670a7aba86cbb442c9b115c9eaf4ca04601b8 Mon Sep 17 00:00:00 2001
2From: Jakub Jelen <jjelen@redhat.com>
3Date: Thu, 11 Dec 2025 13:22:44 +0100
4Subject: [PATCH] sftp: Fix out-of-bound read from sftp extensions
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Signed-off-by: Jakub Jelen <jjelen@redhat.com>
10Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
11(cherry picked from commit 855a0853ad3abd4a6cd85ce06fce6d8d4c7a0b60)
12
13Upstream-Status: Backport [https://git.libssh.org/projects/libssh.git/commit/?id=f80670a7aba86cbb442c9b115c9eaf4ca04601b8]
14CVE: CVE-2026-3731
15Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
16---
17 src/sftp.c | 4 ++--
18 1 file changed, 2 insertions(+), 2 deletions(-)
19
20diff --git a/src/sftp.c b/src/sftp.c
21index e01012a8..4a77141b 100644
22--- a/src/sftp.c
23+++ b/src/sftp.c
24@@ -768,7 +768,7 @@ const char *sftp_extensions_get_name(sftp_session sftp, unsigned int idx) {
25 return NULL;
26 }
27
28- if (idx > sftp->ext->count) {
29+ if (idx >= sftp->ext->count) {
30 ssh_set_error_invalid(sftp->session);
31 return NULL;
32 }
33@@ -784,7 +784,7 @@ const char *sftp_extensions_get_data(sftp_session sftp, unsigned int idx) {
34 return NULL;
35 }
36
37- if (idx > sftp->ext->count) {
38+ if (idx >= sftp->ext->count) {
39 ssh_set_error_invalid(sftp->session);
40 return NULL;
41 }
42--
432.43.0
44
diff --git a/meta-oe/recipes-support/libssh/libssh/CVE-2026-3731-2.patch b/meta-oe/recipes-support/libssh/libssh/CVE-2026-3731-2.patch
new file mode 100644
index 0000000000..ae0ffefa03
--- /dev/null
+++ b/meta-oe/recipes-support/libssh/libssh/CVE-2026-3731-2.patch
@@ -0,0 +1,102 @@
1From 02c6f5f7ec8629a7cff6a28cde9701ab10304540 Mon Sep 17 00:00:00 2001
2From: Jakub Jelen <jjelen@redhat.com>
3Date: Thu, 11 Dec 2025 13:21:23 +0100
4Subject: Reproducer for out of bounds read of SFTP extensions
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Signed-off-by: Jakub Jelen <jjelen@redhat.com>
10Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
11(cherry picked from commit b90b7f24517efa7ab21506db9379aa3dce9fee7d)
12
13Upstream-Status: Backport [https://git.libssh.org/projects/libssh.git/commit/?id=02c6f5f7ec8629a7cff6a28cde9701ab10304540]
14CVE: CVE-2026-3731
15Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
16---
17 tests/client/torture_sftp_init.c | 62 +++++++++++++++++++++++++++++++++++++++-
18 1 file changed, 61 insertions(+), 1 deletion(-)
19
20diff --git a/tests/client/torture_sftp_init.c b/tests/client/torture_sftp_init.c
21index a17f01fe2..cdc244263 100644
22--- a/tests/client/torture_sftp_init.c
23+++ b/tests/client/torture_sftp_init.c
24@@ -72,6 +72,63 @@ static void session_setup_channel(void **state)
25 assert_non_null(s->ssh.tsftp);
26 }
27
28+static void session_setup_extensions(void **state)
29+{
30+ struct torture_state *s = *state;
31+ struct passwd *pwd = NULL;
32+ int rc, count;
33+ const char *name = NULL, *data = NULL;
34+ sftp_session sftp = NULL;
35+
36+ pwd = getpwnam("bob");
37+ assert_non_null(pwd);
38+
39+ rc = setuid(pwd->pw_uid);
40+ assert_return_code(rc, errno);
41+
42+ s->ssh.session = torture_ssh_session(s,
43+ TORTURE_SSH_SERVER,
44+ NULL,
45+ TORTURE_SSH_USER_ALICE,
46+ NULL);
47+ assert_non_null(s->ssh.session);
48+
49+ s->ssh.tsftp = torture_sftp_session(s->ssh.session);
50+ assert_non_null(s->ssh.tsftp);
51+ sftp = s->ssh.tsftp->sftp;
52+
53+ /* null parameter */
54+ count = sftp_extensions_get_count(NULL);
55+ assert_int_equal(count, 0);
56+
57+ count = sftp_extensions_get_count(sftp);
58+ assert_int_not_equal(count, 0);
59+
60+ /* first null parameter */
61+ name = sftp_extensions_get_name(NULL, 0);
62+ assert_null(name);
63+ data = sftp_extensions_get_data(NULL, 0);
64+ assert_null(data);
65+
66+ /* First extension */
67+ name = sftp_extensions_get_name(sftp, 0);
68+ assert_non_null(name);
69+ data = sftp_extensions_get_data(sftp, 0);
70+ assert_non_null(data);
71+
72+ /* Last extension */
73+ name = sftp_extensions_get_name(sftp, count - 1);
74+ assert_non_null(name);
75+ data = sftp_extensions_get_data(sftp, count - 1);
76+ assert_non_null(data);
77+
78+ /* Overrun */
79+ name = sftp_extensions_get_name(sftp, count);
80+ assert_null(name);
81+ data = sftp_extensions_get_data(sftp, count);
82+ assert_null(data);
83+}
84+
85 static int session_teardown(void **state)
86 {
87 struct torture_state *s = *state;
88@@ -92,7 +149,10 @@ int torture_run_tests(void) {
89 session_teardown),
90 cmocka_unit_test_setup_teardown(session_setup_channel,
91 NULL,
92- session_teardown)
93+ session_teardown),
94+ cmocka_unit_test_setup_teardown(session_setup_extensions,
95+ NULL,
96+ session_teardown),
97 };
98
99 ssh_init();
100--
101cgit v1.2.3
102
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 de37719b09..614b656216 100644
--- a/meta-oe/recipes-support/libssh/libssh_0.10.6.bb
+++ b/meta-oe/recipes-support/libssh/libssh_0.10.6.bb
@@ -22,6 +22,8 @@ SRC_URI = "git://git.libssh.org/projects/libssh.git;protocol=https;branch=stable
22 file://CVE-2025-8277-2.patch \ 22 file://CVE-2025-8277-2.patch \
23 file://CVE-2025-8277-3.patch \ 23 file://CVE-2025-8277-3.patch \
24 file://CVE-2025-8277-4.patch \ 24 file://CVE-2025-8277-4.patch \
25 file://CVE-2026-3731-1.patch \
26 file://CVE-2026-3731-2.patch \
25 " 27 "
26SRCREV = "10e09e273f69e149389b3e0e5d44b8c221c2e7f6" 28SRCREV = "10e09e273f69e149389b3e0e5d44b8c221c2e7f6"
27 29