Skip to content

Commit 5e07dee

Browse files
committed
upstream: Don't reply to PING in preauth phase or during KEX
Reported by the Qualys Security Advisory team. ok markus@ OpenBSD-Commit-ID: c656ac4abd1504389d1733d85152044b15830217
1 parent fb07101 commit 5e07dee

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packet.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: packet.c,v 1.317 2024/08/23 04:51:00 deraadt Exp $ */
1+
/* $OpenBSD: packet.c,v 1.318 2025/02/18 08:02:12 djm Exp $ */
22
/*
33
* Author: Tatu Ylonen <[email protected]>
44
* Copyright (c) 1995 Tatu Ylonen <[email protected]>, Espoo, Finland
@@ -1864,6 +1864,14 @@ ssh_packet_read_poll_seqnr(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
18641864
if ((r = sshpkt_get_string_direct(ssh, &d, &len)) != 0)
18651865
return r;
18661866
DBG(debug("Received SSH2_MSG_PING len %zu", len));
1867+
if (!ssh->state->after_authentication) {
1868+
DBG(debug("Won't reply to PING in preauth"));
1869+
break;
1870+
}
1871+
if (ssh_packet_is_rekeying(ssh)) {
1872+
DBG(debug("Won't reply to PING during KEX"));
1873+
break;
1874+
}
18671875
if ((r = sshpkt_start(ssh, SSH2_MSG_PONG)) != 0 ||
18681876
(r = sshpkt_put_string(ssh, d, len)) != 0 ||
18691877
(r = sshpkt_send(ssh)) != 0)

0 commit comments

Comments
 (0)