openssh/backport-fix-CVE-2025-26465.patch
bitianyuan 4d5ebc8cbb fix CVE-2025-26465 CVE-2025-32728
Signed-off-by: bitianyuan <bitianyuan@huawei.com>
2025-04-13 21:21:04 +08:00

102 lines
3.2 KiB
Diff

From 0832aac79517611dd4de93ad0a83577994d9c907 Mon Sep 17 00:00:00 2001
From: "djm@openbsd.org" <djm@openbsd.org>
Date: Tue, 18 Feb 2025 08:02:48 +0000
Subject: upstream: Fix cases where error codes were not correctly set
Reported by the Qualys Security Advisory team. ok markus@
OpenBSD-Commit-ID: 7bcd4ffe0fa1e27ff98d451fb9c22f5fae6e610d
Conflict:NA
Reference:https://anongit.mindrot.org/openssh.git/commit/?id=0832aac79517611dd4de93ad0a83577994d9c907
---
krl.c | 2 ++
ssh-sk-client.c | 1 +
sshconnect2.c | 5 ++++-
sshsig.c | 1 +
4 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/krl.c b/krl.c
index 03476de..6b3e7a0 100644
--- a/krl.c
+++ b/krl.c
@@ -677,6 +677,7 @@ revoked_certs_generate(struct revoked_certs *rc, struct sshbuf *buf)
break;
case KRL_SECTION_CERT_SERIAL_BITMAP:
if (rs->lo - bitmap_start > INT_MAX) {
+ r = SSH_ERR_INVALID_FORMAT;
error("%s: insane bitmap gap", __func__);
goto out;
}
@@ -1012,6 +1013,7 @@ ssh_krl_from_blob(struct sshbuf *buf, struct ssh_krl **krlp,
goto out;
if ((krl = ssh_krl_init()) == NULL) {
+ r = SSH_ERR_ALLOC_FAIL;
error("%s: alloc failed", __func__);
goto out;
}
diff --git a/ssh-sk-client.c b/ssh-sk-client.c
index 8d7e6c3..bc5e189 100644
--- a/ssh-sk-client.c
+++ b/ssh-sk-client.c
@@ -420,6 +420,7 @@ sshsk_load_resident(const char *provider_path, const char *device,
if ((tmp = recallocarray(keys, nkeys, nkeys + 1,
sizeof(*keys))) == NULL) {
error("%s: recallocarray keys failed", __func__);
+ r = SSH_ERR_ALLOC_FAIL;
goto out;
}
debug("%s: keys[%zu]: %s %s", __func__,
diff --git a/sshconnect2.c b/sshconnect2.c
index ae018ff..aee158d 100644
--- a/sshconnect2.c
+++ b/sshconnect2.c
@@ -97,7 +97,7 @@ struct sockaddr *xxx_hostaddr;
static int
verify_host_key_callback(struct sshkey *hostkey, struct ssh *ssh)
{
- if (verify_host_key(xxx_host, xxx_hostaddr, hostkey) == -1)
+ if (verify_host_key(xxx_host, xxx_hostaddr, hostkey) != 0)
fatal("Host key verification failed.");
return 0;
}
@@ -765,6 +765,7 @@ input_userauth_pk_ok(int type, u_int32_t seq, struct ssh *ssh)
if ((pktype = sshkey_type_from_name(pkalg)) == KEY_UNSPEC) {
debug("%s: server sent unknown pkalg %s", __func__, pkalg);
+ r = SSH_ERR_INVALID_FORMAT;
goto done;
}
if ((r = sshkey_from_blob(pkblob, blen, &key)) != 0) {
@@ -775,6 +776,7 @@ input_userauth_pk_ok(int type, u_int32_t seq, struct ssh *ssh)
error("input_userauth_pk_ok: type mismatch "
"for decoded key (received %d, expected %d)",
key->type, pktype);
+ r = SSH_ERR_INVALID_FORMAT;
goto done;
}
@@ -794,6 +796,7 @@ input_userauth_pk_ok(int type, u_int32_t seq, struct ssh *ssh)
SSH_FP_DEFAULT);
error("%s: server replied with unknown key: %s %s", __func__,
sshkey_type(key), fp == NULL ? "<ERROR>" : fp);
+ r = SSH_ERR_INVALID_FORMAT;
goto done;
}
ident = format_identity(id);
diff --git a/sshsig.c b/sshsig.c
index e63a36e..2ce994d 100644
--- a/sshsig.c
+++ b/sshsig.c
@@ -908,6 +908,7 @@ cert_filter_principals(const char *path, u_long linenum,
}
if ((principals = sshbuf_dup_string(nprincipals)) == NULL) {
error("%s: buffer error", __func__);
+ r = SSH_ERR_ALLOC_FAIL;
goto out;
}
/* success */
--
2.43.0