🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.bugs.dist
Article #5711

Bug#1154980: trixie-pu: package libstrophe/0.14.0-4

#5711
From: Martin
Date: Mon, 23 Nov 2026 09:30
331 lines
13574 bytes
--=-=-=
Content-Type: text/plain

Package: release.debian.org
Severity: normal
Tags: trixie
User: release.debian.org@packages.debian.org
Usertags: pu

[ Reason ]
added upstream patch to fix CVE-2026-112063

[ Impact ]
CVE-2026-112063 remains open

[ Tests ]
upstream patch has tests, tests run on build

[ Risks ]
no idea

[ Checklist ]
  [x] *all* changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in (old)stable
  [x] the issue is verified as fixed in unstable
      (and testing)

[ Changes ]
added upstream patch to fix CVE-2026-112063

[ Other info ]
package is already uploaded to p-u, sorry for that

--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=libstrophe_0.14.0-4+deb13u1.debdiff
Content-Description: debdiff

diff -Nru libstrophe-0.14.0/debian/changelog libstrophe-0.14.0/debian/changelog
--- libstrophe-0.14.0/debian/changelog	2025-03-20 19:51:16.000000000 +0000
+++ libstrophe-0.14.0/debian/changelog	2026-11-17 19:50:42.000000000 +0000
@@ -1,3 +1,12 @@
+libstrophe (0.14.0-4+deb13u1) trixie; urgency=medium
+
+  * Team upload
+  * d/patches:
+    Add 0002-Fix-SASL-CVE-2026-112063.patch
+    Fixes stack buffer overflow on oversized SCRAM, i.e. CVE-2026-112063
+
+ -- Martin <debacle@debian.org>  Tue, 17 Nov 2026 19:50:42 +0000
+
 libstrophe (0.14.0-4) unstable; urgency=medium
 
   * Add Breaks/Replaces in libstrophe-doc (Closes: #1100944)
diff -Nru libstrophe-0.14.0/debian/patches/0002-Fix-SASL-CVE-2026-112063.patch libstrophe-0.14.0/debian/patches/0002-Fix-SASL-CVE-2026-112063.patch
--- libstrophe-0.14.0/debian/patches/0002-Fix-SASL-CVE-2026-112063.patch	1970-01-01 00:00:00.000000000 +0000
+++ libstrophe-0.14.0/debian/patches/0002-Fix-SASL-CVE-2026-112063.patch	2026-11-17 19:45:14.000000000 +0000
@@ -0,0 +1,264 @@
+From 252ec0208eb9a0d077afcc53351fca99e2efe81f Mon Sep 17 00:00:00 2001
+From: Bohdan <bohdan.molodan@gmail.com>
+Date: Thu, 12 Nov 2026 13:27:41 +0200
+Subject: [PATCH] Fix stack buffer overflow on oversized SCRAM salt
+
+SCRAM_Hi() copies the salt into a 128 byte buffer on the stack and
+appends INT(1) to it, so it can only handle salts of up to 124 bytes.
+That limit was only enforced by an assert(), which is compiled out as
+soon as NDEBUG is defined.
+
+The salt isn't under our control though. It is taken verbatim from the
+'s=' attribute of the server-first-message, base64-decoded by
+sasl_scram() without any limit on the resulting length, and passed down
+to SCRAM_Hi() through SCRAM_ClientKey(). A malicious server can
+therefore send an 's=' attribute that decodes to more than 124 bytes and
+overflow the stack frame of SCRAM_Hi(), which aborts the client in debug
+builds and silently corrupts the stack otherwise.
+
+Turn the assert() into a runtime check and propagate the failure through
+SCRAM_ClientKey() up to sasl_scram(), which already aborts the
+authentication when it can't compute a response.
+
+This is CVE-2026-112063.
+
+Reproduced with a 125 byte salt in an NDEBUG build under ASan, before
+the fix:
+
+  ERROR: AddressSanitizer: stack-buffer-overflow
+  WRITE of size 4 ...
+      #1 SCRAM_Hi scram.c:189
+      #2 SCRAM_ClientKey scram.c:215
+      #3 sasl_scram sasl.c:457
+
+Fixes: ea719cd02ac1 ("SCRAM-SHA-1 authentication mechanism support")
+Signed-off-by: Bohdan <bohdan.molodan@gmail.com>
+Acked-by: Steffen Jaeckel <s@jaeckel.eu>
+---
+ src/sasl.c         |  7 ++++--
+ src/scram.c        | 60 +++++++++++++++++++++++++++++-----------------
+ src/scram.h        | 19 +++++++++------
+ tests/test_scram.c | 51 ++++++++++++++++++++++++++++++++++-----
+ 4 files changed, 100 insertions(+), 37 deletions(-)
+
+--- a/src/sasl.c
++++ b/src/sasl.c
+@@ -454,8 +454,11 @@
+         goto out_auth;
+     }
+ 
+-    SCRAM_ClientKey(alg, (uint8_t *)password, strlen(password), (uint8_t *)sval,
+-                    sval_len, (uint32_t)ival, key);
++    if (SCRAM_ClientKey(alg, (uint8_t *)password, strlen(password),
++                        (uint8_t *)sval, sval_len, (uint32_t)ival, key) != 0) {
++        strophe_error(ctx, "SASL", "can't process the salt sent by the server");
++        goto out_auth;
++    }
+     SCRAM_ClientSignature(alg, key, (uint8_t *)auth, strlen(auth), sign);
+     SCRAM_ClientProof(alg, key, sign, sign);
+ 
+--- a/src/scram.c
++++ b/src/scram.c
+@@ -30,6 +30,11 @@
+ 
+ #define HMAC_BLOCK_SIZE_MAX 128
+ 
++/* Maximum length of a salt SCRAM_Hi() can process. The salt is concatenated
++ * with INT(1) into a buffer on the stack, see SCRAM_Hi().
++ */
++#define SCRAM_SALT_MAX 124
++
+ static const uint8_t ipad = 0x36;
+ static const uint8_t opad = 0x5C;
+ 
+@@ -163,26 +168,31 @@
+     alg->final((void *)&ctx, digest);
+ }
+ 
+-static void SCRAM_Hi(const struct hash_alg *alg,
+-                     const uint8_t *text,
+-                     size_t len,
+-                     const uint8_t *salt,
+-                     size_t salt_len,
+-                     uint32_t i,
+-                     uint8_t *digest)
++static int SCRAM_Hi(const struct hash_alg *alg,
++                    const uint8_t *text,
++                    size_t len,
++                    const uint8_t *salt,
++                    size_t salt_len,
++                    uint32_t i,
++                    uint8_t *digest)
+ {
++    static uint8_t int1[] = {0x0, 0x0, 0x0, 0x1};
++
+     size_t k;
+     uint32_t j;
+-    uint8_t tmp[128];
+-
+-    static uint8_t int1[] = {0x0, 0x0, 0x0, 0x1};
++    uint8_t tmp[SCRAM_SALT_MAX + sizeof(int1)];
+ 
+-    /* assume salt + INT(1) isn't longer than sizeof(tmp) */
+-    assert(salt_len <= sizeof(tmp) - sizeof(int1));
++    /* The salt is attacker-controlled, it comes from the 's=' attribute of
++     * the server-first-message, therefore this has to be checked at runtime
++     * instead of with assert().
++     */
++    if (salt_len > SCRAM_SALT_MAX) {
++        return -1;
++    }
+ 
+     memset(digest, 0, alg->digest_size);
+     if (i == 0) {
+-        return;
++        return 0;
+     }
+ 
+     memcpy(tmp, salt, salt_len);
+@@ -198,23 +208,29 @@
+             digest[k] ^= tmp[k];
+         }
+     }
++
++    return 0;
+ }
+ 
+-void SCRAM_ClientKey(const struct hash_alg *alg,
+-                     const uint8_t *password,
+-                     size_t len,
+-                     const uint8_t *salt,
+-                     size_t salt_len,
+-                     uint32_t i,
+-                     uint8_t *key)
++int SCRAM_ClientKey(const struct hash_alg *alg,
++                    const uint8_t *password,
++                    size_t len,
++                    const uint8_t *salt,
++                    size_t salt_len,
++                    uint32_t i,
++                    uint8_t *key)
+ {
+     uint8_t salted[SCRAM_DIGEST_SIZE];
+ 
+     /* XXX: Normalize(password) is omitted */
+ 
+-    SCRAM_Hi(alg, password, len, salt, salt_len, i, salted);
++    if (SCRAM_Hi(alg, password, len, salt, salt_len, i, salted) != 0) {
++        return -1;
++    }
+     crypto_HMAC(alg, salted, alg->digest_size, (uint8_t *)"Client Key",
+                 strlen("Client Key"), key);
++
++    return 0;
+ }
+ 
+ void SCRAM_ClientSignature(const struct hash_alg *alg,
+--- a/src/scram.h
++++ b/src/scram.h
+@@ -37,13 +37,18 @@
+ extern const struct hash_alg *scram_algs[];
+ extern const size_t scram_algs_num;
+ 
+-void SCRAM_ClientKey(const struct hash_alg *alg,
+-                     const uint8_t *password,
+-                     size_t len,
+-                     const uint8_t *salt,
+-                     size_t salt_len,
+-                     uint32_t i,
+-                     uint8_t *key);
++/** Compute the SCRAM ClientKey.
++ *
++ *  @return 0 on success, -1 if the salt is too long to be processed. 'key' is
++ *      left untouched in the error case.
++ */
++int SCRAM_ClientKey(const struct hash_alg *alg,
++                    const uint8_t *password,
++                    size_t len,
++                    const uint8_t *salt,
++                    size_t salt_len,
++                    uint32_t i,
++                    uint8_t *key);
+ 
+ void SCRAM_ClientSignature(const struct hash_alg *alg,
+                            const uint8_t *ClientKey,
+--- a/tests/test_scram.c
++++ b/tests/test_scram.c
+@@ -68,15 +68,51 @@
+     printf("Derivation function SCRAM_Hi tests for %s.\n", alg->scram_name);
+     for (i = 0; i < ARRAY_SIZE(df_vectors); ++i) {
+         printf("Test #%d: ", (int)i + 1);
+-        SCRAM_Hi(alg, (uint8_t *)df_vectors[i].P, df_vectors[i].P_len,
+-                 (uint8_t *)df_vectors[i].S, df_vectors[i].S_len,
+-                 df_vectors[i].c, dk);
++        ENSURE_EQ(0, SCRAM_Hi(alg, (uint8_t *)df_vectors[i].P,
++                              df_vectors[i].P_len, (uint8_t *)df_vectors[i].S,
++                              df_vectors[i].S_len, df_vectors[i].c, dk));
+         s = test_bin_to_hex(dk, alg->digest_size);
+         COMPARE(df_vectors[i].DK, s);
+         printf("ok\n");
+     }
+ }
+ 
++/*
++ * CVE-2026-112063: a malicious server could send a 's=' attribute in its
++ * server-first-message that decodes to a salt longer than the buffer
++ * SCRAM_Hi() concatenates it into. An oversized salt has to be rejected
++ * instead of overflowing that buffer.
++ */
++static const struct {
++    size_t salt_len;
++    int rc;
++} salt_vectors[] = {
++    {SCRAM_SALT_MAX, 0},
++    {SCRAM_SALT_MAX + 1, -1},
++};
++
++static void test_salt_len(const struct hash_alg *alg)
++{
++    size_t i;
++    uint8_t salt[SCRAM_SALT_MAX + 1];
++    uint8_t dk[SCRAM_DIGEST_SIZE];
++    uint8_t key[SCRAM_DIGEST_SIZE];
++
++    printf("Salt length tests for %s.\n", alg->scram_name);
++    memset(salt, 'A', sizeof(salt));
++    for (i = 0; i < ARRAY_SIZE(salt_vectors); ++i) {
++        printf("Test #%d: ", (int)i + 1);
++        ENSURE_EQ(salt_vectors[i].rc,
++                  SCRAM_Hi(alg, (uint8_t *)"password", 8, salt,
++                           salt_vectors[i].salt_len, 1, dk));
++        /* the result has to be propagated to the caller */
++        ENSURE_EQ(salt_vectors[i].rc,
++                  SCRAM_ClientKey(alg, (uint8_t *)"password", 8, salt,
++                                  salt_vectors[i].salt_len, 1, key));
++        printf("ok\n");
++    }
++}
++
+ /* RFC6120 */
+ static const struct {
+     char *password;
+@@ -121,9 +157,9 @@
+                  scram_vectors[i].challenge, scram_vectors[i].response);
+         test_hex_to_bin(scram_vectors[i].salt, salt, &salt_len);
+ 
+-        SCRAM_ClientKey(alg, (uint8_t *)scram_vectors[i].password,
+-                        strlen(scram_vectors[i].password), salt, salt_len,
+-                        scram_vectors[i].i, key);
++        ENSURE_EQ(0, SCRAM_ClientKey(alg, (uint8_t *)scram_vectors[i].password,
++                                     strlen(scram_vectors[i].password), salt,
++                                     salt_len, scram_vectors[i].i, key));
+         SCRAM_ClientSignature(alg, key, (uint8_t *)auth, strlen(auth), sign);
+         for (j = 0; j < alg->digest_size; j++) {
+             sign[j] ^= key[j];
+@@ -207,6 +243,9 @@
+ int main()
+ {
+     test_df(&scram_sha1);
++    test_salt_len(&scram_sha1);
++    test_salt_len(&scram_sha256);
++    test_salt_len(&scram_sha512);
+     test_scram(&scram_sha1);
+     test_hmac(&scram_sha1);
+     test_hmac(&scram_sha256);
diff -Nru libstrophe-0.14.0/debian/patches/series libstrophe-0.14.0/debian/patches/series
--- libstrophe-0.14.0/debian/patches/series	1970-01-01 00:00:00.000000000 +0000
+++ libstrophe-0.14.0/debian/patches/series	2026-11-17 19:46:01.000000000 +0000
@@ -0,0 +1 @@
+0002-Fix-SASL-CVE-2026-112063.patch

--=-=-=--
Technical Details
Message-ID: <O2yx3-dDRK-1@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.corradoroberto.it!bofh.it!news.nic.it!robomod

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.corradoroberto.it!bofh.it!news.nic.it!robomod
From: Martin <debacle@debian.org>
Newsgroups: linux.debian.bugs.dist,linux.debian.devel.release
Subject: Bug#1154980: trixie-pu: package libstrophe/0.14.0-4
Date: Mon, 23 Nov 2026 10:30:02 +0100
Message-ID: <O2yx3-dDRK-1@gated-at.bofh.it>
X-Original-To: Debian Bug Tracking System <submit@bugs.debian.org>
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org  Mon Nov 23 09:27:09 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -1.7
Reply-To: Martin <debacle@debian.org>, 1154980@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: debian-release@lists.debian.org
X-Debian-Pr-Message: report 1154980
X-Debian-Pr-Package: release.debian.org
X-Debian-Pr-Keywords: trixie
User-Agent: mu4e 1.14.2; emacs 30.2
Accept-Language: de, en, es
Jabber-ID: debacle@debian.org
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Debian-User: debacle
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/2004379
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 331
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Mon, 23 Nov 2026 09:24:47 +0000
X-Original-Message-ID: <87v75ngasg.fsf@debian>