From 5d77afeca30de907a73071216a0e47fd4433fbad Mon Sep 17 00:00:00 2001 From: Dhanraj E Date: Tue, 17 Nov 2026 22:42:21 +0530 Subject: [PATCH] cf-serverd: Fixed heap over-read dumping session key on bad SSYNCH decrypt When the encrypted payload of a classic protocol SSYNCH request fails to decrypt, BusyWithClassicConnection() calls DebugBinOut(conn->session_key, 32, ...). The session key is allocated in AuthenticationDialogue() with CfSessionKeySize(), which returns CF_BLOWFISHSIZE (16) in community builds, so every such request reads 16 bytes past the end of the heap allocation. DebugBinOut() walks the buffer before Log() checks the log level, so the over-read happens at any log level, and with verbose logging the session key and the adjacent heap bytes are written to the cf-serverd log. An authenticated classic protocol client (allowlegacyconnects) triggers it with an SSYNCH request carrying a 1-byte payload, which can never pass EVP_DecryptFinal_ex(). Removed the dump, since writing the session key to the log has no diagnostic value. The "Bad decrypt" error is kept. Changelog: Title Signed-off-by: Dhanraj E --- cf-serverd/server_classic.c | 1 - 1 file changed, 1 deletion(-) diff --git a/cf-serverd/server_classic.c b/cf-serverd/server_classic.c index 3f05f32552a..fc17d5414ed 100644 --- a/cf-serverd/server_classic.c +++ b/cf-serverd/server_classic.c @@ -1377,7 +1377,6 @@ bool BusyWithClassicConnection(EvalContext *ctx, ServerConnectionState *conn) if (plainlen < 0) { - DebugBinOut((char *) conn->session_key, 32, "Session key"); Log(LOG_LEVEL_ERR, "Bad decrypt (%d)", len); }