openssh/backport-fix-CVE-2025-26466.patch
bitianyuan a7d21f3c0b Fix CVE-2025-26465 CVE-2025-26466
Signed-off-by: bitianyuan <bitianyuan@huawei.com>
2025-02-19 01:01:56 +00:00

37 lines
1.2 KiB
Diff

From 6ce00f0c2ecbb9f75023dbe627ee6460bcec78c2 Mon Sep 17 00:00:00 2001
From: "djm@openbsd.org" <djm@openbsd.org>
Date: Tue, 18 Feb 2025 08:02:12 +0000
Subject: 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
Conflict:NA
Reference:https://anongit.mindrot.org/openssh.git/commit/?id=6ce00f0c2ecbb9f75023dbe627ee6460bcec78c2
---
packet.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/packet.c b/packet.c
index 00ec509..5da9239 100644
--- a/packet.c
+++ b/packet.c
@@ -1812,6 +1812,14 @@ ssh_packet_read_poll_seqnr(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
if ((r = sshpkt_get_string_direct(ssh, &d, &len)) != 0)
return r;
DBG(debug("Received SSH2_MSG_PING len %zu", len));
+ if (!ssh->state->after_authentication) {
+ DBG(debug("Won't reply to PING in preauth"));
+ break;
+ }
+ if (ssh_packet_is_rekeying(ssh)) {
+ DBG(debug("Won't reply to PING during KEX"));
+ break;
+ }
if ((r = sshpkt_start(ssh, SSH2_MSG_PONG)) != 0 ||
(r = sshpkt_put_string(ssh, d, len)) != 0 ||
(r = sshpkt_send(ssh)) != 0)
--
2.33.0