Skip to content

Commit 14b9efb

Browse files
committed
Fix GSS C25519 server blob bounds check
The GSS Curve25519 client path checked sshbuf_ptr(server_blob)[sshbuf_len(server_blob)] when rejecting public keys with the high bit set. That indexes one byte past the end of the sshbuf payload. The byte after Q_S is the first byte of the following MIC string length, encoded in network byte order. With OpenSSH's packet size limit this byte is normally zero, so the bug usually made the intended high-bit rejection a no-op rather than causing random failures. A peer can send a high-bit-set Q_S, but it still has to produce the GSS MIC over the exchange hash for the exact values used. This does not appear to provide key compromise or authentication bypass; it is a correctness fix for the validation policy carried by the GSS KEX patch. Reject an empty server blob explicitly, then test the last payload byte at sshbuf_len(server_blob) - 1 before passing the blob to kex_c25519_dec().
1 parent f35aa95 commit 14b9efb

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

kexgssc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,8 @@ kexgss_client(struct ssh *ssh)
246246
r = kex_dh_dec(kex, server_blob, &shared_secret);
247247
break;
248248
case KEX_GSS_C25519_SHA256:
249-
if (sshbuf_ptr(server_blob)[sshbuf_len(server_blob)] & 0x80)
249+
if (sshbuf_len(server_blob) &&
250+
(sshbuf_ptr(server_blob)[sshbuf_len(server_blob) - 1] & 0x80))
250251
fatal("The received key has MSB of last octet set!");
251252
r = kex_c25519_dec(kex, server_blob, &shared_secret);
252253
break;

0 commit comments

Comments
 (0)