Skip to contentSkip to conversation

libssh: Fix CVE-2026-0968

PATCH In review Deepak Rathore -X (deeratho - E INFOCHIPS PRIVATE LIMITED at Cisco) 1 participant 1 message Apr 6

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 libssh: Fix CVE-2026-0968

From: Deepak Rathore <[email protected]>

Pick the patch [1] and [2] as mentioned in [3]

[1] https://git.libssh.org/projects/libssh.git/commit/?id=796d85f786dff62bd4bcc4408d9b7bbc855841e9
[2] https://git.libssh.org/projects/libssh.git/commit/?id=212121971fb26e1e00b72bd5402c0454a4d84c03
[3] https://security-tracker.debian.org/tracker/CVE-2026-0968

---
 .../libssh/libssh/CVE-2026-0968_p1.patch      |  64 +++++++++
 .../libssh/libssh/CVE-2026-0968_p2.patch      | 132 ++++++++++++++++++
 .../recipes-support/libssh/libssh_0.11.3.bb   |   2 +
 3 files changed, 198 insertions(+)
 create mode 100644 meta-oe/recipes-support/libssh/libssh/CVE-2026-0968_p1.patch
 create mode 100644 meta-oe/recipes-support/libssh/libssh/CVE-2026-0968_p2.patch
meta-oe/recipes-support/libssh/libssh/CVE-2026-0968_p1.patch new file +64 -0
new file mode 100644
index 0000000000..97ae88b2be
@@ -0,0 +1,64 @@
+From 14a1c80ce06cd2c3e4798ec08b25a55ddaf95076 Mon Sep 17 00:00:00 2001
+From: Jakub Jelen <[email protected]>
+Date: Mon, 22 Dec 2025 20:59:11 +0100
+Subject: [PATCH 1/4] CVE-2026-0968: sftp: Sanitize input handling in
+ sftp_parse_longname()
+
+CVE: CVE-2026-0968
+Upstream-Status: Backport [https://git.libssh.org/projects/libssh.git/commit/?id=796d85f786dff62bd4bcc4408d9b7bbc855841e9]
+
+Signed-off-by: Jakub Jelen <[email protected]>
+Reviewed-by: Andreas Schneider <[email protected]>
+(cherry picked from commit 20856f44c146468c830da61dcbbbaa8ce71e390b)
+(cherry picked from commit 796d85f786dff62bd4bcc4408d9b7bbc855841e9)
+Signed-off-by: Deepak Rathore <[email protected]>
+---
+ src/sftp_common.c | 16 +++++++++++++---
+ 1 file changed, 13 insertions(+), 3 deletions(-)
+
+diff --git a/src/sftp_common.c b/src/sftp_common.c
+index 13512b8d..b05597d8 100644
+--- a/src/sftp_common.c
++++ b/src/sftp_common.c
+@@ -461,16 +461,21 @@ static char * sftp_parse_longname(const char *longname,
+     const char *p, *q;
+     size_t len, field = 0;
+ 
++    if (longname == NULL || longname_field < SFTP_LONGNAME_PERM ||
++        longname_field > SFTP_LONGNAME_NAME) {
++        return NULL;
++    }
++
+     p = longname;
+     /*
+      * Find the beginning of the field which is specified
+      * by sftp_longname_field_e.
+      */
+-    while (field != longname_field) {
++    while (*p != '\0' && field != longname_field) {
+         if (isspace(*p)) {
+             field++;
+             p++;
+-            while (*p && isspace(*p)) {
++            while (*p != '\0' && isspace(*p)) {
+                 p++;
+             }
+         } else {
+@@ -478,8 +483,13 @@ static char * sftp_parse_longname(const char *longname,
+         }
+     }
+ 
++    /* If we reached NULL before we got our field fail */
++    if (field != longname_field) {
++        return NULL;
++    }
++
+     q = p;
+-    while (! isspace(*q)) {
++    while (*q != '\0' && !isspace(*q)) {
+         q++;
+     }
+ 
+-- 
+2.51.0
+
meta-oe/recipes-support/libssh/libssh/CVE-2026-0968_p2.patch new file +132 -0

132 lines not on this page · raw message

meta-oe/recipes-support/libssh/libssh_0.11.3.bb +2 -0
index ab47931fa3..1d4fd637d9 100644
@@ -11,6 +11,8 @@ SRC_URI = "git://git.libssh.org/projects/libssh.git;protocol=https;branch=stable
            file://run-ptest \
            file://CVE-2026-3731_p1.patch \
            file://CVE-2026-3731_p2.patch \
+           file://CVE-2026-0968_p1.patch \
+           file://CVE-2026-0968_p2.patch \
           "
 
 SRC_URI:append:toolchain-clang = " file://0001-CompilerChecks.cmake-drop-Wunused-variable-flag.patch"
Signature · 1 line
2.35.6