summaryrefslogtreecommitdiff
path: root/kex.c
diff options
context:
space:
mode:
authormarkus@openbsd.org <markus@openbsd.org>2016-10-10 19:28:48 +0000
committerColin Watson <cjwatson@debian.org>2016-10-24 11:12:15 +0100
commitb139635512b1af75e82252c0c71ac66e08b78774 (patch)
tree1440fe1b02a88224a5f077ec8d4905ae5ead96ec /kex.c
parent4c914ccd85bbf391c4dc61b85e3c178fef465e3f (diff)
upstream commit
Unregister the KEXINIT handler after message has been received. Otherwise an unauthenticated peer can repeat the KEXINIT and cause allocation of up to 128MB -- until the connection is closed. Reported by shilei-c at 360.cn Upstream-ID: 43649ae12a27ef94290db16d1a98294588b75c05 Origin: https://anongit.mindrot.org/openssh.git/commit/?id=ec165c392ca54317dbe3064a8c200de6531e89ad Bug-Debian: https://bugs.debian.org/841884 Bug-Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1384860 Last-Update: 2016-10-24 Patch-Name: unregister-kexinit.patch
Diffstat (limited to 'kex.c')
-rw-r--r--kex.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/kex.c b/kex.c
index c17d652c9..7ab72ba19 100644
--- a/kex.c
+++ b/kex.c
@@ -488,6 +488,7 @@ kex_input_kexinit(int type, u_int32_t seq, void *ctxt)
488 if (kex == NULL) 488 if (kex == NULL)
489 return SSH_ERR_INVALID_ARGUMENT; 489 return SSH_ERR_INVALID_ARGUMENT;
490 490
491 ssh_dispatch_set(ssh, SSH2_MSG_KEXINIT, NULL);
491 ptr = sshpkt_ptr(ssh, &dlen); 492 ptr = sshpkt_ptr(ssh, &dlen);
492 if ((r = sshbuf_put(kex->peer, ptr, dlen)) != 0) 493 if ((r = sshbuf_put(kex->peer, ptr, dlen)) != 0)
493 return r; 494 return r;