Skip to content

Commit b781a8a

Browse files
[AUTO-CHERRYPICK] [AUTO-PR] Fix CVE-2025-26465 for openssh (#12527)
1 parent 98a6565 commit b781a8a

2 files changed

Lines changed: 139 additions & 1 deletion

File tree

SPECS/openssh/CVE-2025-26465.patch

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
From 7f9da65b35f156ceef07d7c19f3ba7297cd9b015 Mon Sep 17 00:00:00 2001
2+
From: Jon Slobodzian <joslobo@microsoft.com>
3+
Date: Sun, 16 Feb 2025 19:35:33 +0000
4+
Subject: [PATCH] Patch for CVE-2025-26465 and CVE-2025-26466
5+
6+
---
7+
krl.c | 2 ++
8+
ssh-agent.c | 3 +++
9+
ssh-sk-client.c | 2 ++
10+
sshconnect2.c | 5 ++++-
11+
sshsig.c | 1 +
12+
5 files changed, 12 insertions(+), 1 deletion(-)
13+
14+
diff --git a/krl.c b/krl.c
15+
index 17b88ed..aef2001 100644
16+
--- a/krl.c
17+
+++ b/krl.c
18+
@@ -674,6 +674,7 @@ revoked_certs_generate(struct revoked_certs *rc, struct sshbuf *buf)
19+
break;
20+
case KRL_SECTION_CERT_SERIAL_BITMAP:
21+
if (rs->lo - bitmap_start > INT_MAX) {
22+
+ r = SSH_ERR_INVALID_FORMAT;
23+
error_f("insane bitmap gap");
24+
goto out;
25+
}
26+
@@ -1008,6 +1009,7 @@ ssh_krl_from_blob(struct sshbuf *buf, struct ssh_krl **krlp,
27+
goto out;
28+
29+
if ((krl = ssh_krl_init()) == NULL) {
30+
+ r = SSH_ERR_ALLOC_FAIL;
31+
error_f("alloc failed");
32+
goto out;
33+
}
34+
diff --git a/ssh-agent.c b/ssh-agent.c
35+
index 25e2f7d..9df167b 100644
36+
--- a/ssh-agent.c
37+
+++ b/ssh-agent.c
38+
@@ -1198,6 +1198,7 @@ parse_key_constraint_extension(struct sshbuf *m, char **sk_providerp,
39+
"restrict-destination-v00@openssh.com") == 0) {
40+
if (*dcsp != NULL) {
41+
error_f("%s already set", ext_name);
42+
+ r = SSH_ERR_INVALID_FORMAT;
43+
goto out;
44+
}
45+
if ((r = sshbuf_froms(m, &b)) != 0) {
46+
@@ -1207,6 +1208,7 @@ parse_key_constraint_extension(struct sshbuf *m, char **sk_providerp,
47+
while (sshbuf_len(b) != 0) {
48+
if (*ndcsp >= AGENT_MAX_DEST_CONSTRAINTS) {
49+
error_f("too many %s constraints", ext_name);
50+
+ r = SSH_ERR_INVALID_FORMAT;
51+
goto out;
52+
}
53+
*dcsp = xrecallocarray(*dcsp, *ndcsp, *ndcsp + 1,
54+
@@ -1663,6 +1665,7 @@ process_ext_session_bind(SocketEntry *e)
55+
/* record new key/sid */
56+
if (e->nsession_ids >= AGENT_MAX_SESSION_IDS) {
57+
error_f("too many session IDs recorded");
58+
+ r = -1;
59+
goto out;
60+
}
61+
e->session_ids = xrecallocarray(e->session_ids, e->nsession_ids,
62+
diff --git a/ssh-sk-client.c b/ssh-sk-client.c
63+
index 321fe53..750accb 100644
64+
--- a/ssh-sk-client.c
65+
+++ b/ssh-sk-client.c
66+
@@ -439,6 +439,7 @@ sshsk_load_resident(const char *provider_path, const char *device,
67+
}
68+
if ((srk = calloc(1, sizeof(*srk))) == NULL) {
69+
error_f("calloc failed");
70+
+ r = SSH_ERR_ALLOC_FAIL;
71+
goto out;
72+
}
73+
srk->key = key;
74+
@@ -450,6 +451,7 @@ sshsk_load_resident(const char *provider_path, const char *device,
75+
if ((tmp = recallocarray(srks, nsrks, nsrks + 1,
76+
sizeof(*srks))) == NULL) {
77+
error_f("recallocarray keys failed");
78+
+ r = SSH_ERR_ALLOC_FAIL;
79+
goto out;
80+
}
81+
debug_f("srks[%zu]: %s %s uidlen %zu", nsrks,
82+
diff --git a/sshconnect2.c b/sshconnect2.c
83+
index 923e7a7..53ee447 100644
84+
--- a/sshconnect2.c
85+
+++ b/sshconnect2.c
86+
@@ -96,7 +96,7 @@ static int
87+
verify_host_key_callback(struct sshkey *hostkey, struct ssh *ssh)
88+
{
89+
if (verify_host_key(xxx_host, xxx_hostaddr, hostkey,
90+
- xxx_conn_info) == -1)
91+
+ xxx_conn_info) != 0)
92+
fatal("Host key verification failed.");
93+
return 0;
94+
}
95+
@@ -699,6 +699,7 @@ input_userauth_pk_ok(int type, u_int32_t seq, struct ssh *ssh)
96+
97+
if ((pktype = sshkey_type_from_name(pkalg)) == KEY_UNSPEC) {
98+
debug_f("server sent unknown pkalg %s", pkalg);
99+
+ r = SSH_ERR_INVALID_FORMAT;
100+
goto done;
101+
}
102+
if ((r = sshkey_from_blob(pkblob, blen, &key)) != 0) {
103+
@@ -709,6 +710,7 @@ input_userauth_pk_ok(int type, u_int32_t seq, struct ssh *ssh)
104+
error("input_userauth_pk_ok: type mismatch "
105+
"for decoded key (received %d, expected %d)",
106+
key->type, pktype);
107+
+ r = SSH_ERR_INVALID_FORMAT;
108+
goto done;
109+
}
110+
111+
@@ -728,6 +730,7 @@ input_userauth_pk_ok(int type, u_int32_t seq, struct ssh *ssh)
112+
SSH_FP_DEFAULT);
113+
error_f("server replied with unknown key: %s %s",
114+
sshkey_type(key), fp == NULL ? "<ERROR>" : fp);
115+
+ r = SSH_ERR_INVALID_FORMAT;
116+
goto done;
117+
}
118+
ident = format_identity(id);
119+
diff --git a/sshsig.c b/sshsig.c
120+
index 7736134..76d7c21 100644
121+
--- a/sshsig.c
122+
+++ b/sshsig.c
123+
@@ -857,6 +857,7 @@ cert_filter_principals(const char *path, u_long linenum,
124+
}
125+
if ((principals = sshbuf_dup_string(nprincipals)) == NULL) {
126+
error_f("buffer error");
127+
+ r = SSH_ERR_ALLOC_FAIL;
128+
goto out;
129+
}
130+
/* success */
131+
--
132+
2.40.4
133+

SPECS/openssh/openssh.spec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Summary: Free version of the SSH connectivity tools
44
Name: openssh
55
Version: %{openssh_ver}
6-
Release: 6%{?dist}
6+
Release: 7%{?dist}
77
License: BSD
88
Vendor: Microsoft Corporation
99
Distribution: Mariner
@@ -48,6 +48,7 @@ Patch319: CVE-2023-48795-0009-upstream-implement-strict-key-exchange-in-ss
4848
Patch350: CVE-2023-28531.patch
4949
# Patch for CVE-2024-6387 can be removed if openssh is upgraded to version 9.8p1 or greater
5050
Patch351: CVE-2024-6387.patch
51+
Patch352: CVE-2025-26465.patch
5152
BuildRequires: audit-devel
5253
BuildRequires: autoconf
5354
BuildRequires: e2fsprogs-devel
@@ -134,6 +135,7 @@ popd
134135
%patch319 -p1 -b .cve-2023-48795-0009
135136
%patch350 -p1 -b .cve-2023-28531
136137
%patch351 -p1 -b .cve-2024-6387
138+
%patch352 -p1 -b .cve-2025-26465
137139

138140
%build
139141
export CFLAGS="$CFLAGS -fpic"
@@ -290,6 +292,9 @@ fi
290292
%{_mandir}/man8/ssh-sk-helper.8.gz
291293

292294
%changelog
295+
* Fri Feb 14 2025 Jon Slobodzian <joslobo@microsoft.com> - 8.9p1-7
296+
- Patch for CVE-2025-26465 and CVE-2025-26466.
297+
293298
* Tue Jul 2 2024 Sean Dougherty <sdougherty@microsoft.com> - 8.9p1-6
294299
- Add patch for CVE-2024-6387 (a.k.a. "regresshion") using Debian's source as guidance.
295300

0 commit comments

Comments
 (0)