Source: memcached Version: 1.6.38-1 Severity: grave Tags: patch security X-Debbugs-Cc: [email protected]
Hi, I prepared one trixie fix for CVE-2026-47783 and CVE-2026-47784 from upstream commit d13f282b4bce33a9c33b8a1bbf07f12114160fed. It uses safe_memcmp, clears the input line, and scans the full password file. The tested trixie debdiff is attached. BTS #1137214 is archived. Both builds passed 43,301 tests in 8 files and 180,312 in 87 files. Focused SASL passed 34/34 tests. The plaintext backend compiled on both; Lintian showed the existing lsb-base warning on both builds. Hopefully it helps for the next trixie point release! Happy to adjust anything Dickson Prepared with AI assistance (OpenAI Codex) and reviewed by me before sending.
diff -Nru '--exclude=.pc' inspection/debian/changelog packaged/debian/changelog --- inspection/debian/changelog 2025-03-21 09:37:27.000000000 +0000 +++ packaged/debian/changelog 2026-11-26 11:09:06.225994107 +0000 @@ -1,3 +1,10 @@ +memcached (1.6.38-1+deb13u1) trixie; urgency=medium + + * Backport upstream fix for CVE-2026-47783 (scan the full SASL database). + * Fix CVE-2026-47784 (constant-time SASL password check). + + -- Dickson Wu <[email protected]> Thu, 26 Nov 2026 00:30:00 +0000 + memcached (1.6.38-1) unstable; urgency=medium * New upstream release. diff -Nru '--exclude=.pc' inspection/debian/patches/CVE-2026-47783.patch packaged/debian/patches/CVE-2026-47783.patch --- inspection/debian/patches/CVE-2026-47783.patch 1970-01-01 00:00:00.000000000 +0000 +++ packaged/debian/patches/CVE-2026-47783.patch 2026-11-26 10:43:32.260706225 +0000 @@ -0,0 +1,44 @@ +Description: Use constant-time SASL checks and scan the full password database +Origin: upstream, https://github.com/memcached/memcached/commit/d13f282b4bce33a9c33b8a1bbf07f12114160fed +Bug-Debian: https://bugs.debian.org/1137214 +Applied-Upstream: d13f282b4bce33a9c33b8a1bbf07f12114160fed +Last-Update: 2026-11-26 + +--- + sasl_defs.c | 21 ++++++++++----------- + 1 file changed, 10 insertions(+), 11 deletions(-) + +diff --git a/sasl_defs.c b/sasl_defs.c +index e73a5707ac..98a1f752ac 100644 +--- a/sasl_defs.c ++++ b/sasl_defs.c +@@ -71,19 +71,18 @@ static int sasl_server_userdb_checkpass(sasl_conn_t *conn, + char buffer[MAX_ENTRY_LEN]; + bool ok = false; + +- while ((fgets(buffer, sizeof(buffer), pwfile)) != NULL) { +- if (memcmp(user, buffer, unmlen) == 0 && buffer[unmlen] == ':') { +- /* This is the correct user */ +- ++unmlen; +- if (memcmp(pass, buffer + unmlen, passlen) == 0 && +- (buffer[unmlen + passlen] == ':' || /* Additional tokens */ +- buffer[unmlen + passlen] == '\n' || /* end of line */ +- buffer[unmlen + passlen] == '\r'|| /* dos format? */ +- buffer[unmlen + passlen] == '\0')) { /* line truncated */ ++ while (1) { ++ memset(buffer, 0, sizeof(buffer)); ++ if (fgets(buffer, sizeof(buffer), pwfile) == NULL) ++ break; ++ if (safe_memcmp(user, buffer, unmlen) && buffer[unmlen] == ':') { ++ if (safe_memcmp(pass, buffer + unmlen + 1, passlen) && ++ (buffer[unmlen + 1 + passlen] == ':' || ++ buffer[unmlen + 1 + passlen] == '\n' || ++ buffer[unmlen + 1 + passlen] == '\r' || ++ buffer[unmlen + 1 + passlen] == '\0')) { + ok = true; + } +- +- break; + } + } + (void)fclose(pwfile); diff -Nru '--exclude=.pc' inspection/debian/patches/series packaged/debian/patches/series --- inspection/debian/patches/series 2025-03-21 09:37:27.000000000 +0000 +++ packaged/debian/patches/series 2026-11-26 10:43:32.260706225 +0000 @@ -3,3 +3,4 @@ 0003-Uses-retry-to-wait-up-to-5-seconds-for-the-killed-pr.patch 0005-Source-etc-default-memcached-in-etc-init.d-memcached.patch 0006-restore-systemd-sandboxing.patch +CVE-2026-47783.patch diff -Nru '--exclude=.pc' inspection/sasl_defs.c packaged/sasl_defs.c --- inspection/sasl_defs.c 2024-10-31 20:47:40.000000000 +0000 +++ packaged/sasl_defs.c 2026-11-26 10:43:32.257706190 +0000 @@ -71,19 +71,18 @@ char buffer[MAX_ENTRY_LEN]; bool ok = false; - while ((fgets(buffer, sizeof(buffer), pwfile)) != NULL) { - if (memcmp(user, buffer, unmlen) == 0 && buffer[unmlen] == ':') { - /* This is the correct user */ - ++unmlen; - if (memcmp(pass, buffer + unmlen, passlen) == 0 && - (buffer[unmlen + passlen] == ':' || /* Additional tokens */ - buffer[unmlen + passlen] == '\n' || /* end of line */ - buffer[unmlen + passlen] == '\r'|| /* dos format? */ - buffer[unmlen + passlen] == '\0')) { /* line truncated */ + while (1) { + memset(buffer, 0, sizeof(buffer)); + if (fgets(buffer, sizeof(buffer), pwfile) == NULL) + break; + if (safe_memcmp(user, buffer, unmlen) && buffer[unmlen] == ':') { + if (safe_memcmp(pass, buffer + unmlen + 1, passlen) && + (buffer[unmlen + 1 + passlen] == ':' || + buffer[unmlen + 1 + passlen] == '\n' || + buffer[unmlen + 1 + passlen] == '\r' || + buffer[unmlen + 1 + passlen] == '\0')) { ok = true; } - - break; } } (void)fclose(pwfile);

