From 4778081866249903c0d66a02fcae247059ab950c Mon Sep 17 00:00:00 2001 From: Warren Date: Sun, 14 Jun 2026 23:14:14 +0800 Subject: [PATCH] Critical fix: KEXINIT exchange hash encoding (prepend SSH_MSG_KEXINIT byte) OpenSSH kexgex.c source code analysis: - KEXINIT payload stored without SSH_MSG_KEXINIT type byte - Exchange hash prepends SSH_MSG_KEXINIT byte (20) with adjusted length Before fix: - client_kexinit_payload included SSH_MSG_KEXINIT byte - Direct use without prepending After fix: - Remove SSH_MSG_KEXINIT byte from payload - Prepend byte (20) in exchange hash with length+1 - Both kex_exchange.rs and kex_complete.rs updated Testing result: MAC still fails, indicating additional encoding issues Next: Detailed comparison of all exchange hash components --- data/auth.sqlite | Bin 73728 -> 73728 bytes markbase-core/src/ssh_server/kex_complete.rs | 16 ++++++++++---- markbase-core/src/ssh_server/kex_exchange.rs | 22 +++++++++++++++---- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/data/auth.sqlite b/data/auth.sqlite index 41ae3dc63b5810950b6a2dbb710c448e90456d86..8dfdb1072de1764e1f13ad3266e367816da992a6 100644 GIT binary patch delta 171 zcmZoTz|wGlWr8&0)QK|Aj8iuzw97CmPd+H6FquR44%^|@CXQa!&97wH7=i4@x?YvZ z-{k%<9d6zHMgBRznY>PL4(f`0Nu!NPFlZkC9 q0|N_~0Ti{zD(dgOo>70Y!~acSga7~MXVl;Rg`e?1Kd(Lm5&!@|5;wE} delta 171 zcmZoTz|wGlWr8&0#ECM_j1xB|w97CmOg<>3FquR44%_w>O&q;Sn_tPYF#_3*b-jv{ zzsdb!+P-4*7y0M>k_&m6WtnpGb5rw5iYnO_aWacCrKINOvn|;CMgIf8z(Q7LPA0ZR q3=Aw_22j)