lrzsz: fix CVE-2026-105841
PATCH v2 1/3 lrzsz: fix CVE-2026-105841
From: Hetvi Thakar <[email protected]>
When invoked under a suffixed name such as lrztar, lrz passes sender-controlled filenames to popen() without shell escaping. A malicious sender can use this to execute commands with the receiving user's privileges.
Backport upstream commit [1], which removes this pipe-execution mode, addressing the vulnerability described in [2].
[1] https://github.com/UweOhse/lrzsz/commit/9eef71ce20fda2b345ef8431359aec96121215bd
[2] https://security-tracker.debian.org/tracker/CVE-2026-105841
---
Changes in v2:
- corrected the advisory reference in commit messsage
--- .../lrzsz/lrzsz-0.12.20/CVE-2026-105841.patch | 267 ++++++++++++++++++ meta/recipes-bsp/lrzsz/lrzsz_0.12.20.bb | 1 + 2 files changed, 268 insertions(+) create mode 100644 meta/recipes-bsp/lrzsz/lrzsz-0.12.20/CVE-2026-105841.patch
meta/recipes-bsp/lrzsz/lrzsz-0.12.20/CVE-2026-105841.patch new file +267 -0
@@ -0,0 +1,267 @@ +From 9eef71ce20fda2b345ef8431359aec96121215bd Mon Sep 17 00:00:00 2001 +From: Uwe Ohse at akiar <[email protected]> +Date: Mon, 10 Aug 2026 17:55:28 +0200 +Subject: [PATCH] remove topipe 'feature' + +CVE: CVE-2026-105841 +Upstream-Status: Backport [https://github.com/UweOhse/lrzsz/commit/9eef71ce20fda2b345ef8431359aec96121215bd] + +Backport Changes: +- Retained sys2() and exec2() and their declarations because 0.12.20 + still calls them in its separate, opt-in ZCOMMAND handling. Removing + them as upstream does causes undefined references when linking lrz. +- Omitted NEWS because its 0.13.0 release-note hunk conflicts with the + 0.12.20 release history and is not needed for the security fix. + +(cherry picked from commit 9eef71ce20fda2b345ef8431359aec96121215bd) +Signed-off-by: Hetvi Thakar <[email protected]> +--- + src/lrz.c | 193 ++++++++++++++++++++++-------------------------------- + 1 file changed, 79 insertions(+), 114 deletions(-) + +diff --git a/src/lrz.c b/src/lrz.c +index ae3c62d..9c08a3d 100644 +--- a/src/lrz.c ++++ b/src/lrz.c +@@ -76,7 +76,6 @@ int skip_if_not_found; + char *Pathname; + const char *program_name; /* the name by which we were called */ + +-int Topipe=0; + int MakeLCPathname=TRUE; /* make received pathname lower case */ + int Verbose=0; + int Quiet=0; /* overrides logic that would otherwise set verbose */ +@@ -803,9 +802,6 @@ fubar: + shortname ? shortname : "no.name", protname()); + #endif + canit(STDOUT_FILENO); +- if (Topipe && fout) { +- pclose(fout); return ERROR; +- } + if (fout) + fclose(fout); + +@@ -1286,111 +1282,89 @@ procheader(char *name, struct zm_fileinfo *zi) + if (!zmodem_requested && MakeLCPathname && !IsAnyLower(name_static) + && !(zi->mode&UNIXFILE)) + uncaps(name_static); +- if (Topipe > 0) { +- if (Pathname) +- free(Pathname); +- Pathname=malloc((PATH_MAX)*2); +- if (!Pathname) +- error(1,0,_("out of memory")); +- sprintf(Pathname, "%s %s", program_name+2, name_static); +- if (Verbose) { +- vstringf("%s: %s %s\n", +- _("Topipe"), +- Pathname, Thisbinary?"BIN":"ASCII"); +- } +- if ((fout=popen(Pathname, "w")) == NULL) +- return ERROR; +- } else { +- if (protocol==ZM_XMODEM) +- /* we don't have the filename yet */ +- return OK; /* dummy */ +- if (Pathname) +- free(Pathname); +- Pathname=malloc((PATH_MAX)*2); +- if (!Pathname) +- error(1,0,_("out of memory")); +- strcpy(Pathname, name_static); +- if (Verbose) { +- /* overwrite the "waiting to receive" line */ +- vstring("\r \r"); +- vstringf(_("Receiving: %s\n"), name_static); +- } +- checkpath(name_static); +- if (Nflag) +- { +- /* cast because we might not have a prototyp for strdup :-/ */ +- free(name_static); +- name_static=(char *) strdup("/dev/null"); +- if (!name_static) +- { +- fprintf(stderr,"%s: %s\n", program_name, _("out of memory")); +- exit(1); +- } +- } +-#ifdef OMEN +- /* looks like a security hole -- uwe */ +- if (name_static[0] == '!' || name_static[0] == '|') { +- if ( !(fout = popen(name_static+1, "w"))) { +- return ERROR; +- } +- Topipe = -1; return(OK); +- } +-#endif +- if (Thisbinary && zconv==ZCRESUM) { +- struct stat st; +- fout = fopen(name_static, "r+"); +- if (fout && 0==fstat(fileno(fout),&st)) +- { +- int can_resume=TRUE; +- if (zmanag==ZF1_ZMCRC) { +- int r=do_crc_check(fout,zi->bytes_total,st.st_size); +- if (r==ERROR) { +- fclose(fout); +- return ZFERR; +- } +- if (r==ZCRC_DIFFERS) { +- can_resume=FALSE; +- } +- } +- if ((unsigned long)st.st_size > zi->bytes_total) { +- can_resume=FALSE; +- } +- /* retransfer whole blocks */ +- zi->bytes_skipped = st.st_size & ~(1023); +- if (can_resume) { +- if (fseek(fout, (long) zi->bytes_skipped, SEEK_SET)) { +- fclose(fout); +- return ZFERR; +- } +- } +- else +- zi->bytes_skipped=0; /* resume impossible, file has changed */ +- goto buffer_it; +- } +- zi->bytes_skipped=0; +- if (fout) +- fclose(fout); +- } +- fout = fopen(name_static, openmode); ++ ++ if (protocol==ZM_XMODEM) ++ /* we don't have the filename yet */ ++ return OK; /* dummy */ ++ if (Pathname) ++ free(Pathname); ++ Pathname=malloc((PATH_MAX)*2); ++ if (!Pathname) ++ error(1,0,_("out of memory")); ++ strcpy(Pathname, name_static); ++ if (Verbose) { ++ /* overwrite the "waiting to receive" line */ ++ vstring("\r \r"); ++ vstringf(_("Receiving: %s\n"), name_static); ++ } ++ checkpath(name_static); ++ if (Nflag) ++ { ++ /* cast because we might not have a prototyp for strdup :-/ */ ++ free(name_static); ++ name_static=(char *) strdup("/dev/null"); ++ if (!name_static) ++ { ++ fprintf(stderr,"%s: %s\n", program_name, _("out of memory")); ++ exit(1); ++ } ++ } ++ ++ if (Thisbinary && zconv==ZCRESUM) { ++ struct stat st; ++ fout = fopen(name_static, "r+"); ++ if (fout && 0==fstat(fileno(fout),&st)) ++ { ++ int can_resume=TRUE; ++ if (zmanag==ZF1_ZMCRC) { ++ int r=do_crc_check(fout,zi->bytes_total,st.st_size); ++ if (r==ERROR) { ++ fclose(fout); ++ return ZFERR; ++ } ++ if (r==ZCRC_DIFFERS) { ++ can_resume=FALSE; ++ } ++ } ++ if ((unsigned long)st.st_size > zi->bytes_total) { ++ can_resume=FALSE; ++ } ++ /* retransfer whole blocks */ ++ zi->bytes_skipped = st.st_size & ~(1023); ++ if (can_resume) { ++ if (fseek(fout, (long) zi->bytes_skipped, SEEK_SET)) { ++ fclose(fout); ++ return ZFERR; ++ } ++ } ++ else ++ zi->bytes_skipped=0; /* resume impossible, file has changed */ ++ goto buffer_it; ++ } ++ zi->bytes_skipped=0; ++ if (fout) ++ fclose(fout); ++ } ++ fout = fopen(name_static, openmode); + #ifdef ENABLE_MKDIR +- if ( !fout && Restricted < 2) { +- if (make_dirs(name_static)) +- fout = fopen(name_static, openmode); +- } ++ if ( !fout && Restricted < 2) { ++ if (make_dirs(name_static)) ++ fout = fopen(name_static, openmode); ++ } + #endif +- if ( !fout) +- { ++ if ( !fout) ++ { + #ifdef ENABLE_SYSLOG +- int e=errno; ++ int e=errno; + #endif +- zpfatal(_("cannot open %s"), name_static); +- DO_SYSLOG((LOG_ERR,"%s: cannot open: %s", +- protname(),strerror(e))); +- return ERROR; +- } +- } ++ zpfatal(_("cannot open %s"), name_static); ++ DO_SYSLOG((LOG_ERR,"%s: cannot open: %s", ++ protname(),strerror(e))); ++ return ERROR; ++ } ++ + buffer_it: +- if (Topipe == 0) { ++ { + static char *s=NULL; + static size_t last_length=0; + #if defined(F_GETFD) && defined(F_SETFD) && defined(O_SYNC) +@@ -1550,8 +1524,7 @@ report(int sct) + } + + /* +- * If called as [-][dir/../]vrzCOMMAND set Verbose to 1 +- * If called as [-][dir/../]rzCOMMAND set the pipe flag ++ * If called as [-][dir/../]vrz set Verbose to 1 + * If called as rb use YMODEM protocol + */ + static void +@@ -1576,8 +1549,6 @@ chkinvok(const char *s) + protocol=ZM_XMODEM; + if (s[0]=='r' && (s[1]=='b' || s[1]=='y')) + protocol=ZM_YMODEM; +- if (s[2] && protocol!=ZM_XMODEM) +- Topipe = 1; + } + + /* +@@ -2207,12 +2178,6 @@ static int + closeit(struct zm_fileinfo *zi) + { + int ret; +- if (Topipe) { +- if (pclose(fout)) { +- return ERROR; +- } +- return OK; +- } + if (in_tcpsync) { + rewind(fout); + if (!fgets(tcp_buf,sizeof(tcp_buf),fout)) { +-- +2.35.6
meta/recipes-bsp/lrzsz/lrzsz_0.12.20.bb +1 -0
@@ -21,6 +21,7 @@ SRC_URI = "https://www.ohse.de/uwe/releases/lrzsz-${PV}.tar.gz \ file://0001-Fix-cross-compilation-using-autoconf-detected-AR.patch \ file://0001-Fix-build-with-GCC-15.patch \ file://0001-lrzsz-convert-K-R-function-definitions-to-ANSI-C-pro.patch \ + file://CVE-2026-105841.patch \ " SRC_URI[sha256sum] = "c28b36b14bddb014d9e9c97c52459852f97bd405f89113f30bee45ed92728ff1"
Signature · 1 line
2.35.6
PATCH v2 2/3 lrzsz: fix CVE-2026-105840
From: Hetvi Thakar <[email protected]>
When built without PUBDIR support, lrz does not reject absolute pathnames in restricted mode. A malicious sender can therefore write outside the receive directory, subject to the receiving user's filesystem permissions.
Backport upstream commit [1], which removes PUBDIR support and makes absolute-path rejection unconditional in the restricted-mode checks, addressing the vulnerability described in [2].
[1] https://github.com/UweOhse/lrzsz/commit/b1fc8a01e3a074f8462a29dca45ed7c8fd2ef665
[2] https://security-tracker.debian.org/tracker/CVE-2026-105840
---
Changes in v2:
- corrected the advisory reference in commit messsage
--- .../lrzsz/lrzsz-0.12.20/CVE-2026-105840.patch | 106 ++++++++++++++++++ meta/recipes-bsp/lrzsz/lrzsz_0.12.20.bb | 1 + 2 files changed, 107 insertions(+) create mode 100644 meta/recipes-bsp/lrzsz/lrzsz-0.12.20/CVE-2026-105840.patch
meta/recipes-bsp/lrzsz/lrzsz-0.12.20/CVE-2026-105840.patch new file +106 -0
@@ -0,0 +1,106 @@ +From b1fc8a01e3a074f8462a29dca45ed7c8fd2ef665 Mon Sep 17 00:00:00 2001 +From: Uwe Ohse at akiar <[email protected]> +Date: Mon, 10 Aug 2026 18:09:20 +0200 +Subject: [PATCH] remove PUBDIR, fix the 2nd security hole found by + tristaninsec + +CVE: CVE-2026-105840 +Upstream-Status: Backport [https://github.com/UweOhse/lrzsz/commit/b1fc8a01e3a074f8462a29dca45ed7c8fd2ef665] + +Backport Changes: +- Applied the configure.ac change to configure.in, which is the build + configuration filename used by lrzsz 0.12.20. +- Omitted NEWS because its 0.13.0 release-note hunk conflicts with the + 0.12.20 release history and is not needed for the security fix. + +(cherry picked from commit b1fc8a01e3a074f8462a29dca45ed7c8fd2ef665) +Signed-off-by: Hetvi Thakar <[email protected]> +--- + configure.in | 7 ------- + src/lrz.c | 16 +++++----------- + src/lsz.c | 9 ++------- + 3 files changed, 7 insertions(+), 25 deletions(-) + +diff --git a/configure.in b/configure.in +index b7c3c31..504bd32 100644 +--- a/configure.in ++++ b/configure.in +@@ -37,13 +37,6 @@ AC_ARG_ENABLE(timesync, + fi], + [AC_DEFINE(ENABLE_TIMESYNC)]) + AC_SUBST(ENABLE_TIMESYNC) +-AC_ARG_ENABLE(pubdir, +- [--enable-pubdir=/path include support for a public writeable directory], +- [if test "$enableval" = "no" ; then +- : +- else +- AC_DEFINE_UNQUOTED(PUBDIR,"$enableval") +- fi]) + AC_ARG_ENABLE(mkdir, + [--disable-mkdir disable support for creating directories (lrz)], + [if test "$enableval" = "no" ; then +diff --git a/src/lrz.c b/src/lrz.c +index 9c08a3d..168636e 100644 +--- a/src/lrz.c ++++ b/src/lrz.c +@@ -1553,12 +1553,10 @@ chkinvok(const char *s) + } + +-/* +- * Totalitarian Communist pathname processing +- */ + static void + checkpath(const char *name) + { + if (Restricted) { ++ FILE *noleak = NULL; + const char *p; + p=strrchr(name,'/'); + if (p) +@@ -1595,20 +1593,16 @@ checkpath(const char *name) + p=name; + /* don't overwrite any file in very restricted mode. + * don't overwrite hidden files in restricted mode */ +- if ((Restricted==2 || *name=='.') && fopen(name, "r") != NULL) { ++ if ((Restricted==2 || *name=='.') && (noleak = fopen(name, "r")) != NULL) { ++ fclose(noleak); + canit(STDOUT_FILENO); + vstring("\r\n"); + vstringf(_("%s: %s exists\n"), + program_name, name); + bibi(-1); + } +- /* restrict pathnames to current tree or uucppublic */ +- if ( strstr(name, "../") +-#ifdef PUBDIR +- || (name[0]== '/' && strncmp(name, PUBDIR, +- strlen(PUBDIR))) +-#endif +- ) { ++ /* restrict pathnames to the current tree */ ++ if ( strstr(name, "../") || name[0] == '/') { + canit(STDOUT_FILENO); + vstring("\r\n"); + vstringf(_("%s:\tSecurity Violation"),program_name); +diff --git a/src/lsz.c b/src/lsz.c +index 69f4fb8..3dd91b1 100644 +--- a/src/lsz.c ++++ b/src/lsz.c +@@ -1009,13 +1009,8 @@ wcs(const char *oname, const char *remotename) + + + if (Restricted) { +- /* restrict pathnames to current tree or uucppublic */ +- if ( strstr(oname, "../") +-#ifdef PUBDIR +- || (oname[0]== '/' && strncmp(oname, MK_STRING(PUBDIR), +- strlen(MK_STRING(PUBDIR)))) +-#endif +- ) { ++ /* restrict pathnames to current tree */ ++ if ( strstr(oname, "../") || oname[0] == '/') { + canit(STDOUT_FILENO); + vchar('\r'); + error(1,0, +-- +2.35.6
meta/recipes-bsp/lrzsz/lrzsz_0.12.20.bb +1 -0
@@ -22,6 +22,7 @@ SRC_URI = "https://www.ohse.de/uwe/releases/lrzsz-${PV}.tar.gz \ file://0001-Fix-build-with-GCC-15.patch \ file://0001-lrzsz-convert-K-R-function-definitions-to-ANSI-C-pro.patch \ file://CVE-2026-105841.patch \ + file://CVE-2026-105840.patch \ " SRC_URI[sha256sum] = "c28b36b14bddb014d9e9c97c52459852f97bd405f89113f30bee45ed92728ff1"
Signature · 1 line
2.35.6
PATCH v2 3/3 lrzsz: fix CVE-2026-105842
In reply to Hetvi Thakar -X (hthakar - E INFOCHIPS PRIVATE LIMITED at Cisco)From: Hetvi Thakar <[email protected]>
Overlong sender-controlled filenames can overflow the fixed-size Pathname buffer when copied with strcpy(), causing heap memory corruption.
Backport upstream commit [1], which replaces the remaining fixed-size Pathname allocations and copies with strdup(). This allocates space for the complete filename and addresses the vulnerability described in [2].
[1] https://github.com/UweOhse/lrzsz/commit/f8caa7b1b1a3a1bb50cf08677b15be7b17c2956f
[2] https://security-tracker.debian.org/tracker/CVE-2026-105842
---
Changes in v2:
- corrected the advisory reference in commit messsage
--- .../lrzsz/lrzsz-0.12.20/CVE-2026-105842.patch | 57 +++++++++++++++++++ meta/recipes-bsp/lrzsz/lrzsz_0.12.20.bb | 1 + 2 files changed, 58 insertions(+) create mode 100644 meta/recipes-bsp/lrzsz/lrzsz-0.12.20/CVE-2026-105842.patch
meta/recipes-bsp/lrzsz/lrzsz-0.12.20/CVE-2026-105842.patch new file +57 -0
@@ -0,0 +1,57 @@ +From f8caa7b1b1a3a1bb50cf08677b15be7b17c2956f Mon Sep 17 00:00:00 2001 +From: Uwe Ohse at akiar <[email protected]> +Date: Mon, 10 Aug 2026 18:40:36 +0200 +Subject: [PATCH] avoid buffer overflows by strdup instead of + malloc(PATH_MAX+...). + +CVE: CVE-2026-105842 +Upstream-Status: Backport [https://github.com/UweOhse/lrzsz/commit/f8caa7b1b1a3a1bb50cf08677b15be7b17c2956f] + +Backport Changes: +- Omitted NEWS because its 0.13.0 release-note hunk conflicts with the + 0.12.20 release history and is not needed for the security fix. + +(cherry picked from commit f8caa7b1b1a3a1bb50cf08677b15be7b17c2956f) +Signed-off-by: Hetvi Thakar <[email protected]> +--- + src/lrz.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/lrz.c b/src/lrz.c +index 168636e..e11f909 100644 +--- a/src/lrz.c ++++ b/src/lrz.c +@@ -743,11 +743,10 @@ wcreceive(int argc, char **argp) + if (Pathname) + free(Pathname); + errno=0; +- Pathname=malloc(PATH_MAX+1); ++ Pathname=strdup(*argp); + if (!Pathname) + error(1,0,_("out of memory")); + +- strcpy(Pathname, *argp); + checkpath(Pathname); + #ifdef ENABLE_SYSLOG + shortname=strrchr(*argp,'/'); +@@ -1288,15 +1287,16 @@ procheader(char *name, struct zm_fileinfo *zi) + return OK; /* dummy */ + if (Pathname) + free(Pathname); +- Pathname=malloc((PATH_MAX)*2); ++ ++ Pathname=strdup(name_static); + if (!Pathname) + error(1,0,_("out of memory")); +- strcpy(Pathname, name_static); + if (Verbose) { + /* overwrite the "waiting to receive" line */ + vstring("\r \r"); + vstringf(_("Receiving: %s\n"), name_static); + } ++ + checkpath(name_static); + if (Nflag) + { +-- +2.35.6
meta/recipes-bsp/lrzsz/lrzsz_0.12.20.bb +1 -0
@@ -23,6 +23,7 @@ SRC_URI = "https://www.ohse.de/uwe/releases/lrzsz-${PV}.tar.gz \ file://0001-lrzsz-convert-K-R-function-definitions-to-ANSI-C-pro.patch \ file://CVE-2026-105841.patch \ file://CVE-2026-105840.patch \ + file://CVE-2026-105842.patch \ " SRC_URI[sha256sum] = "c28b36b14bddb014d9e9c97c52459852f97bd405f89113f30bee45ed92728ff1"
Signature · 1 line
2.35.6