Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libstrophe for openSUSE:Factory checked in at 2026-11-24 17:02:45 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libstrophe (Old) and /work/SRC/openSUSE:Factory/.libstrophe.new.1340718 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libstrophe" Tue Nov 24 17:02:45 2026 rev:19 rq:1400227 version:0.14.0 Changes: -------- --- /work/SRC/openSUSE:Factory/libstrophe/libstrophe.changes 2025-08-13 18:16:06.712943620 +0200 +++ /work/SRC/openSUSE:Factory/.libstrophe.new.1340718/libstrophe.changes 2026-11-24 17:02:46.977378678 +0100 @@ -1,0 +2,6 @@ +Mon Nov 23 15:28:27 UTC 2026 - Michael Vetter <[email protected]> + +- CVE-2026-112063: Fix buffer overflow in SCRAM_Hi (bsc#1285921) + Add CVE-2026-112063.patch + +------------------------------------------------------------------- @@ -4,3 +10,3 @@ -- fix gcc15 build, add libstrophe-0.14.0-gcc15.patch from upstream -- add upstream signing key -- do not bootstrap during build, and other spec file tweaks +- Fix gcc15 build, add libstrophe-0.14.0-gcc15.patch from upstream +- Add upstream signing key +- Do not bootstrap during build, and other spec file tweaks New: ---- CVE-2026-112063.patch ----------(New B)---------- New:- CVE-2026-112063: Fix buffer overflow in SCRAM_Hi (bsc#1285921) Add CVE-2026-112063.patch ----------(New E)---------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libstrophe.spec ++++++ --- /var/tmp/diff_new_pack.95idkc/_old 2026-11-24 17:02:48.045423928 +0100 +++ /var/tmp/diff_new_pack.95idkc/_new 2026-11-24 17:02:48.047424012 +0100 @@ -31,6 +31,7 @@ # "Releases are signed with the GPG key with ID F8ADC1F9A68A7AFF0E2C89E4391A5EFC2D1709DE" Source2: %{name}.keyring Patch0: libstrophe-0.14.0-gcc15.patch +Patch1: CVE-2026-112063.patch BuildRequires: pkgconfig BuildRequires: pkgconfig(libcrypto) BuildRequires: pkgconfig(libssl) ++++++ CVE-2026-112063.patch ++++++ >From 5f701c24065cc479b22dc40a033237adbd4d5956 Mon Sep 17 00:00:00 2001 From: Bohdan <[email protected]> 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 <[email protected]> Acked-by: Steffen Jaeckel <[email protected]> --- src/sasl.c | 7 ++++-- src/scram.c | 60 +++++++++++++++++++++++++++++----------------- src/scram.h | 19 +++++++++------ tests/test_scram.c | 51 ++++++++++++++++++++++++++++++++++----- 4 files changed, 100 insertions(+), 37 deletions(-) diff --git a/src/sasl.c b/src/sasl.c index a280a7f..4d42cf4 100644 --- a/src/sasl.c +++ b/src/sasl.c @@ -454,8 +454,11 @@ char *sasl_scram(xmpp_ctx_t *ctx, 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); diff --git a/src/scram.c b/src/scram.c index 35a62db..7297bff 100644 --- 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 @@ static void crypto_HMAC(const struct hash_alg *alg, 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) { - size_t k; - uint32_t j; - uint8_t tmp[128]; - static uint8_t int1[] = {0x0, 0x0, 0x0, 0x1}; - /* assume salt + INT(1) isn't longer than sizeof(tmp) */ - assert(salt_len <= sizeof(tmp) - sizeof(int1)); + size_t k; + uint32_t j; + uint8_t tmp[SCRAM_SALT_MAX + 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 @@ static void SCRAM_Hi(const struct hash_alg *alg, 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, diff --git a/src/scram.h b/src/scram.h index e7ba5c3..da9056f 100644 --- a/src/scram.h +++ b/src/scram.h @@ -37,13 +37,18 @@ struct hash_alg { 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, diff --git a/tests/test_scram.c b/tests/test_scram.c index 5d2984d..c3c26af 100644 --- a/tests/test_scram.c +++ b/tests/test_scram.c @@ -68,15 +68,51 @@ static void test_df(const struct hash_alg *alg) 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 @@ static void test_scram(const struct hash_alg *alg) 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 @@ static void test_hmac(const struct hash_alg *alg) 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); -- 2.56.1 ++++++ _scmsync.obsinfo ++++++ --- /var/tmp/diff_new_pack.95idkc/_old 2026-11-24 17:02:48.104426427 +0100 +++ /var/tmp/diff_new_pack.95idkc/_new 2026-11-24 17:02:48.108426597 +0100 @@ -1,6 +1,6 @@ -mtime: 1753136280 -commit: ef7b0ca2381417010921206f8ef7c16110c5d54334c8729b820747d0288d3384 -url: https://src.opensuse.org/xmpp/libstrophe.git -revision: ef7b0ca2381417010921206f8ef7c16110c5d54334c8729b820747d0288d3384 +mtime: 1795509530 +commit: 345ba614c05cdf125665cd2733c7ba3873b9a9a9d9f46efdad002e3844e3bbf2 +url: https://src.opensuse.org/xmpp/libstrophe +revision: 345ba614c05cdf125665cd2733c7ba3873b9a9a9d9f46efdad002e3844e3bbf2 projectscmsync: https://src.opensuse.org/xmpp/_ObsPrj.git ++++++ build.specials.obscpio ++++++ ++++++ build.specials.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.gitignore new/.gitignore --- old/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/.gitignore 2026-11-24 09:38:50.000000000 +0100 @@ -0,0 +1 @@ +.osc
