From: Peter Marko <[email protected]>

Pick patch mentioning this CVE number.

Signed-off-by: Peter Marko <[email protected]>
Signed-off-by: Yoann Congal <[email protected]>
---
 meta/recipes-core/dropbear/dropbear.inc       |   1 +
 .../dropbear/dropbear/CVE-2019-6111.patch     | 157 ++++++++++++++++++
 2 files changed, 158 insertions(+)
 create mode 100644 meta/recipes-core/dropbear/dropbear/CVE-2019-6111.patch

diff --git a/meta/recipes-core/dropbear/dropbear.inc 
b/meta/recipes-core/dropbear/dropbear.inc
index 94059df258..cebb1e49c9 100644
--- a/meta/recipes-core/dropbear/dropbear.inc
+++ b/meta/recipes-core/dropbear/dropbear.inc
@@ -34,6 +34,7 @@ SRC_URI = 
"http://matt.ucc.asn.au/dropbear/releases/dropbear-${PV}.tar.bz2 \
            file://0001-Add-m_snprintf-that-won-t-return-negative.patch \
            
file://0001-Handle-arbitrary-length-paths-and-commands-in-multih.patch \
            file://CVE-2025-47203.patch \
+           file://CVE-2019-6111.patch \
           "
 
 PAM_SRC_URI = "file://0005-dropbear-enable-pam.patch \
diff --git a/meta/recipes-core/dropbear/dropbear/CVE-2019-6111.patch 
b/meta/recipes-core/dropbear/dropbear/CVE-2019-6111.patch
new file mode 100644
index 0000000000..84224a5f57
--- /dev/null
+++ b/meta/recipes-core/dropbear/dropbear/CVE-2019-6111.patch
@@ -0,0 +1,157 @@
+From 48a17cff6aa104b8e806ddb2191f83f1024060f1 Mon Sep 17 00:00:00 2001
+From: Matt Johnston <[email protected]>
+Date: Tue, 9 Dec 2025 22:59:19 +0900
+Subject: [PATCH] scp CVE-2019-6111 fix
+
+Cherry-pick from OpenSSH portable
+
+391ffc4b9d31 ("upstream: check in scp client that filenames sent during")
+
+upstream: check in scp client that filenames sent during
+
+remote->local directory copies satisfy the wildcard specified by the user.
+
+This checking provides some protection against a malicious server
+sending unexpected filenames, but it comes at a risk of rejecting wanted
+files due to differences between client and server wildcard expansion rules.
+
+For this reason, this also adds a new -T flag to disable the check.
+
+reported by Harry Sintonen
+fix approach suggested by markus@;
+has been in snaps for ~1wk courtesy deraadt@
+
+CVE: CVE-2019-6111
+Upstream-Status: Backport 
[https://github.com/mkj/dropbear/commit/48a17cff6aa104b8e806ddb2191f83f1024060f1]
+Signed-off-by: Peter Marko <[email protected]>
+---
+ scp.c | 38 +++++++++++++++++++++++++++++---------
+ 1 file changed, 29 insertions(+), 9 deletions(-)
+
+diff --git a/scp.c b/scp.c
+index 384f2cb..bf98986 100644
+--- a/scp.c
++++ b/scp.c
+@@ -76,6 +76,8 @@
+ #include "includes.h"
+ /*RCSID("$OpenBSD: scp.c,v 1.130 2006/01/31 10:35:43 djm Exp $");*/
+ 
++#include <fnmatch.h>
++
+ #include "atomicio.h"
+ #include "compat.h"
+ #include "scpmisc.h"
+@@ -291,14 +293,14 @@ void verifydir(char *);
+ 
+ uid_t userid;
+ int errs, remin, remout;
+-int pflag, iamremote, iamrecursive, targetshouldbedirectory;
++int Tflag, pflag, iamremote, iamrecursive, targetshouldbedirectory;
+ 
+ #define       CMDNEEDS        64
+ char cmd[CMDNEEDS];           /* must hold "rcp -r -p -d\0" */
+ 
+ int response(void);
+ void rsource(char *, struct stat *);
+-void sink(int, char *[]);
++void sink(int, char *[], const char *);
+ void source(int, char *[]);
+ void tolocal(int, char *[]);
+ void toremote(char *, int, char *[]);
+@@ -325,8 +327,8 @@ main(int argc, char **argv)
+       args.list = NULL;
+       addargs(&args, "%s", ssh_program);
+ 
+-      fflag = tflag = 0;
+-      while ((ch = getopt(argc, argv, "dfl:prtvBCc:i:P:q1246S:o:F:")) != -1)
++      fflag = Tflag = tflag = 0;
++      while ((ch = getopt(argc, argv, "dfl:prtTvBCc:i:P:q1246S:o:F:")) != -1)
+               switch (ch) {
+               /* User-visible flags. */
+               case '1':
+@@ -389,9 +391,12 @@ main(int argc, char **argv)
+                       setmode(0, O_BINARY);
+ #endif
+                       break;
++              case 'T':
++                      Tflag = 1;
++                      break;
+               default:
+                       usage();
+-              }
++      }
+       argc -= optind;
+       argv += optind;
+ 
+@@ -409,7 +414,7 @@ main(int argc, char **argv)
+       }
+       if (tflag) {
+               /* Receive data. */
+-              sink(argc, argv);
++              sink(argc, argv, NULL);
+               exit(errs != 0);
+       }
+       if (argc < 2)
+@@ -590,7 +595,7 @@ tolocal(int argc, char **argv)
+                       continue;
+               }
+               xfree(bp);
+-              sink(1, argv + argc - 1);
++              sink(1, argv + argc - 1, src);
+               (void) close(remin);
+               remin = remout = -1;
+       }
+@@ -823,7 +828,7 @@ bwlimit(int amount)
+ }
+ 
+ void
+-sink(int argc, char **argv)
++sink(int argc, char **argv, const char *src)
+ {
+       static BUF buffer;
+       struct stat stb;
+@@ -837,6 +842,7 @@ sink(int argc, char **argv)
+       off_t size, statbytes;
+       int setimes, targisdir, wrerrno = 0;
+       char ch, *cp, *np, *targ, *why, *vect[1], buf[2048];
++      char *src_copy = NULL, *restrict_pattern = NULL;
+       struct timeval tv[2];
+ 
+ #define       atime   tv[0]
+@@ -858,6 +864,17 @@ sink(int argc, char **argv)
+       (void) atomicio(vwrite, remout, "", 1);
+       if (stat(targ, &stb) == 0 && S_ISDIR(stb.st_mode))
+               targisdir = 1;
++      if (src != NULL && !iamrecursive && !Tflag) {
++              /*
++               * Prepare to try to restrict incoming filenames to match
++               * the requested destination file glob.
++               */
++              if ((src_copy = strdup(src)) == NULL)
++                      fatal("strdup failed");
++              if ((restrict_pattern = strrchr(src_copy, '/')) != NULL) {
++                      *restrict_pattern++ = '\0';
++              }
++      }
+       for (first = 1;; first = 0) {
+               cp = buf;
+               if (atomicio(read, remin, cp, 1) != 1)
+@@ -940,6 +957,9 @@ sink(int argc, char **argv)
+                       run_err("error: unexpected filename: %s", cp);
+                       exit(1);
+               }
++              if (restrict_pattern != NULL &&
++                  fnmatch(restrict_pattern, cp, 0) != 0)
++                      SCREWUP("filename does not match request");
+               if (targisdir) {
+                       static char *namebuf = NULL;
+                       static size_t cursize = 0;
+@@ -978,7 +998,7 @@ sink(int argc, char **argv)
+                                       goto bad;
+                       }
+                       vect[0] = xstrdup(np);
+-                      sink(1, vect);
++                      sink(1, vect, src);
+                       if (setimes) {
+                               setimes = 0;
+                               if (utimes(vect[0], tv) < 0)
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#229715): 
https://lists.openembedded.org/g/openembedded-core/message/229715
Mute This Topic: https://lists.openembedded.org/mt/117362642/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to