new file mode 100644
@@ -0,0 +1,31 @@
+From aa1131c9b16478630d41c1e067744b83474b1886 Mon Sep 17 00:00:00 2001
+From: Jakub Jelen <jjelen@redhat.com>
+Date: Tue, 22 Apr 2025 21:18:44 +0200
+Subject: [PATCH] CVE-2025-5318: sftpserver: Fix possible buffer overrun
+
+CVE: CVE-2025-5318
+Upstream-Status: Backport https://git.libssh.org/projects/libssh.git/commit/?id=ae8881dfe54214c0c0eb88345c35e15a14081b3d
+
+Signed-off-by: Jakub Jelen <jjelen@redhat.com>
+Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
+Signed-off-by: Ravineet Singh <ravineet.a.singh@est.tech>
+---
+ src/sftpserver.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/sftpserver.c b/src/sftpserver.c
+index 9117f155..b3349e16 100644
+--- a/src/sftpserver.c
++++ b/src/sftpserver.c
+@@ -538,7 +538,7 @@ void *sftp_handle(sftp_session sftp, ssh_string handle){
+
+ memcpy(&val, ssh_string_data(handle), sizeof(uint32_t));
+
+- if (val > SFTP_HANDLES) {
++ if (val >= SFTP_HANDLES) {
+ return NULL;
+ }
+
+--
+2.43.0
+
@@ -9,6 +9,7 @@ DEPENDS = "zlib openssl"
SRC_URI = "git://git.libssh.org/projects/libssh.git;protocol=https;branch=stable-0.10 \
file://0001-tests-CMakeLists.txt-do-not-search-ssh-sshd-commands.patch \
file://0001-libgcrypt.c-Fix-prototype-of-des3_encrypt-des3_decry.patch \
+ file://0001-CVE-2025-5318-sftpserver-Fix-possible-buffer-overrun.patch \
file://run-ptest \
"
SRCREV = "10e09e273f69e149389b3e0e5d44b8c221c2e7f6"
Fixes a likely read beyond bounds in sftp server handle Reference: https://nvd.nist.gov/vuln/detail/CVE-2025-5318 Upstream patch: https://git.libssh.org/projects/libssh.git/commit/?id=ae8881dfe54214c0c0eb88345c35e15a14081b3d Signed-off-by: Ravineet Singh <ravineet.a.singh@est.tech> --- ...tpserver-Fix-possible-buffer-overrun.patch | 31 +++++++++++++++++++ .../recipes-support/libssh/libssh_0.10.6.bb | 1 + 2 files changed, 32 insertions(+) create mode 100644 meta-oe/recipes-support/libssh/libssh/0001-CVE-2025-5318-sftpserver-Fix-possible-buffer-overrun.patch