Skip to content

Commit 7891e73

Browse files
authored
Merge pull request #3858 from citrus-it/opensshr46
openssh: Fixes for CVE-2025-2646[56] (r151046)
2 parents e70b06e + 9cddf5e commit 7891e73

File tree

6 files changed

+187
-2
lines changed

6 files changed

+187
-2
lines changed

build/openssh/build.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
# }}}
1414
#
1515
# Copyright 2015 OmniTI Computer Consulting, Inc. All rights reserved.
16-
# Copyright 2024 OmniOS Community Edition (OmniOSce) Association.
16+
# Copyright 2025 OmniOS Community Edition (OmniOSce) Association.
1717

1818
. ../../lib/build.sh
1919

2020
PROG=openssh
2121
VER=9.6p1
22-
DASHREV=1
22+
DASHREV=2
2323
PKG=network/openssh
2424
SUMMARY="OpenSSH Client and utilities"
2525
DESC="OpenSSH Secure Shell protocol Client and associated Utilities"
+149
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
From 0832aac79517611dd4de93ad0a83577994d9c907 Mon Sep 17 00:00:00 2001
2+
From: "djm@openbsd.org" <djm@openbsd.org>
3+
Date: Tue, 18 Feb 2025 08:02:48 +0000
4+
Subject: [PATCH] upstream: Fix cases where error codes were not correctly set
5+
6+
Reported by the Qualys Security Advisory team. ok markus@
7+
8+
OpenBSD-Commit-ID: 7bcd4ffe0fa1e27ff98d451fb9c22f5fae6e610d
9+
---
10+
krl.c | 4 +++-
11+
ssh-agent.c | 7 ++++++-
12+
ssh-sk-client.c | 4 +++-
13+
sshconnect2.c | 7 +++++--
14+
sshsig.c | 3 ++-
15+
5 files changed, 19 insertions(+), 6 deletions(-)
16+
17+
diff --git a/krl.c b/krl.c
18+
index e2efdf0667a7..0d0f69534182 100644
19+
--- a/krl.c
20+
+++ b/krl.c
21+
@@ -674,6 +674,7 @@ revoked_certs_generate(struct revoked_certs *rc, struct sshbuf *buf)
22+
break;
23+
case KRL_SECTION_CERT_SERIAL_BITMAP:
24+
if (rs->lo - bitmap_start > INT_MAX) {
25+
+ r = SSH_ERR_INVALID_FORMAT;
26+
error_f("insane bitmap gap");
27+
goto out;
28+
}
29+
@@ -1059,6 +1060,7 @@ ssh_krl_from_blob(struct sshbuf *buf, struct ssh_krl **krlp)
30+
}
31+
32+
if ((krl = ssh_krl_init()) == NULL) {
33+
+ r = SSH_ERR_ALLOC_FAIL;
34+
error_f("alloc failed");
35+
goto out;
36+
}
37+
diff --git a/ssh-agent.c b/ssh-agent.c
38+
index 48973b2c142a..c27c5a956f2c 100644
39+
--- a/ssh-agent.c
40+
+++ b/ssh-agent.c
41+
@@ -1220,6 +1220,7 @@ parse_key_constraint_extension(struct sshbuf *m, char **sk_providerp,
42+
"restrict-destination-v00@openssh.com") == 0) {
43+
if (*dcsp != NULL) {
44+
error_f("%s already set", ext_name);
45+
+ r = SSH_ERR_INVALID_FORMAT;
46+
goto out;
47+
}
48+
if ((r = sshbuf_froms(m, &b)) != 0) {
49+
@@ -1229,6 +1230,7 @@ parse_key_constraint_extension(struct sshbuf *m, char **sk_providerp,
50+
while (sshbuf_len(b) != 0) {
51+
if (*ndcsp >= AGENT_MAX_DEST_CONSTRAINTS) {
52+
error_f("too many %s constraints", ext_name);
53+
+ r = SSH_ERR_INVALID_FORMAT;
54+
goto out;
55+
}
56+
*dcsp = xrecallocarray(*dcsp, *ndcsp, *ndcsp + 1,
57+
@@ -1246,6 +1248,7 @@ parse_key_constraint_extension(struct sshbuf *m, char **sk_providerp,
58+
}
59+
if (*certs != NULL) {
60+
error_f("%s already set", ext_name);
61+
+ r = SSH_ERR_INVALID_FORMAT;
62+
goto out;
63+
}
64+
if ((r = sshbuf_get_u8(m, &v)) != 0 ||
65+
@@ -1257,6 +1260,7 @@ parse_key_constraint_extension(struct sshbuf *m, char **sk_providerp,
66+
while (sshbuf_len(b) != 0) {
67+
if (*ncerts >= AGENT_MAX_EXT_CERTS) {
68+
error_f("too many %s constraints", ext_name);
69+
+ r = SSH_ERR_INVALID_FORMAT;
70+
goto out;
71+
}
72+
*certs = xrecallocarray(*certs, *ncerts, *ncerts + 1,
73+
@@ -1757,6 +1761,7 @@ process_ext_session_bind(SocketEntry *e)
74+
/* record new key/sid */
75+
if (e->nsession_ids >= AGENT_MAX_SESSION_IDS) {
76+
error_f("too many session IDs recorded");
77+
+ r = -1;
78+
goto out;
79+
}
80+
e->session_ids = xrecallocarray(e->session_ids, e->nsession_ids,
81+
diff --git a/ssh-sk-client.c b/ssh-sk-client.c
82+
index 321fe53a2d91..06fad22134fb 100644
83+
--- a/ssh-sk-client.c
84+
+++ b/ssh-sk-client.c
85+
@@ -439,6 +439,7 @@ sshsk_load_resident(const char *provider_path, const char *device,
86+
}
87+
if ((srk = calloc(1, sizeof(*srk))) == NULL) {
88+
error_f("calloc failed");
89+
+ r = SSH_ERR_ALLOC_FAIL;
90+
goto out;
91+
}
92+
srk->key = key;
93+
@@ -450,6 +451,7 @@ sshsk_load_resident(const char *provider_path, const char *device,
94+
if ((tmp = recallocarray(srks, nsrks, nsrks + 1,
95+
sizeof(*srks))) == NULL) {
96+
error_f("recallocarray keys failed");
97+
+ r = SSH_ERR_ALLOC_FAIL;
98+
goto out;
99+
}
100+
debug_f("srks[%zu]: %s %s uidlen %zu", nsrks,
101+
diff --git a/sshconnect2.c b/sshconnect2.c
102+
index a69c4da18773..1ee6000ab0cc 100644
103+
--- a/sshconnect2.c
104+
+++ b/sshconnect2.c
105+
@@ -99,7 +99,7 @@ verify_host_key_callback(struct sshkey *hostkey, struct ssh *ssh)
106+
options.required_rsa_size)) != 0)
107+
fatal_r(r, "Bad server host key");
108+
if (verify_host_key(xxx_host, xxx_hostaddr, hostkey,
109+
- xxx_conn_info) == -1)
110+
+ xxx_conn_info) != 0)
111+
fatal("Host key verification failed.");
112+
return 0;
113+
}
114+
@@ -699,6 +699,7 @@ input_userauth_pk_ok(int type, u_int32_t seq, struct ssh *ssh)
115+
116+
if ((pktype = sshkey_type_from_name(pkalg)) == KEY_UNSPEC) {
117+
debug_f("server sent unknown pkalg %s", pkalg);
118+
+ r = SSH_ERR_INVALID_FORMAT;
119+
goto done;
120+
}
121+
if ((r = sshkey_from_blob(pkblob, blen, &key)) != 0) {
122+
@@ -709,6 +710,7 @@ input_userauth_pk_ok(int type, u_int32_t seq, struct ssh *ssh)
123+
error("input_userauth_pk_ok: type mismatch "
124+
"for decoded key (received %d, expected %d)",
125+
key->type, pktype);
126+
+ r = SSH_ERR_INVALID_FORMAT;
127+
goto done;
128+
}
129+
130+
@@ -728,6 +730,7 @@ input_userauth_pk_ok(int type, u_int32_t seq, struct ssh *ssh)
131+
SSH_FP_DEFAULT);
132+
error_f("server replied with unknown key: %s %s",
133+
sshkey_type(key), fp == NULL ? "<ERROR>" : fp);
134+
+ r = SSH_ERR_INVALID_FORMAT;
135+
goto done;
136+
}
137+
ident = format_identity(id);
138+
diff --git a/sshsig.c b/sshsig.c
139+
index 6e03c0b06d85..3da005d621f9 100644
140+
--- a/sshsig.c
141+
+++ b/sshsig.c
142+
@@ -879,6 +879,7 @@ cert_filter_principals(const char *path, u_long linenum,
143+
}
144+
if ((principals = sshbuf_dup_string(nprincipals)) == NULL) {
145+
error_f("buffer error");
146+
+ r = SSH_ERR_ALLOC_FAIL;
147+
goto out;
148+
}
149+
/* success */
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
From 6ce00f0c2ecbb9f75023dbe627ee6460bcec78c2 Mon Sep 17 00:00:00 2001
2+
From: "djm@openbsd.org" <djm@openbsd.org>
3+
Date: Tue, 18 Feb 2025 08:02:12 +0000
4+
Subject: [PATCH] upstream: Don't reply to PING in preauth phase or during KEX
5+
6+
Reported by the Qualys Security Advisory team. ok markus@
7+
8+
OpenBSD-Commit-ID: c656ac4abd1504389d1733d85152044b15830217
9+
---
10+
packet.c | 10 +++++++++-
11+
1 file changed, 9 insertions(+), 1 deletion(-)
12+
13+
diff --git a/packet.c b/packet.c
14+
index 486f8515746e..9dea2cfc5188 100644
15+
--- a/packet.c
16+
+++ b/packet.c
17+
@@ -1864,6 +1864,14 @@ ssh_packet_read_poll_seqnr(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p)
18+
if ((r = sshpkt_get_string_direct(ssh, &d, &len)) != 0)
19+
return r;
20+
DBG(debug("Received SSH2_MSG_PING len %zu", len));
21+
+ if (!ssh->state->after_authentication) {
22+
+ DBG(debug("Won't reply to PING in preauth"));
23+
+ break;
24+
+ }
25+
+ if (ssh_packet_is_rekeying(ssh)) {
26+
+ DBG(debug("Won't reply to PING during KEX"));
27+
+ break;
28+
+ }
29+
if ((r = sshpkt_start(ssh, SSH2_MSG_PONG)) != 0 ||
30+
(r = sshpkt_put_string(ssh, d, len)) != 0 ||
31+
(r = sshpkt_send(ssh)) != 0)

build/openssh/patches/series

+2
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ sshd_config.patch
2121
0031-Restore-tcpwrappers-libwrap-support.patch
2222
test.patch
2323
sshsigdie-async-signal-unsafe.patch
24+
CVE-2025-26465.patch
25+
CVE-2025-26466.patch

build/openssh/patches/series.aarch64

+2
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ sshd_config.patch
2020
0031-Restore-tcpwrappers-libwrap-support.patch
2121
test.patch
2222
sk-dummy-openssl.patch
23+
CVE-2025-26465.patch
24+
CVE-2025-26466.patch

build/openssh/testsuite.log

+1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ ok known hosts command
8080
ok agent restrictions
8181
ok channel timeout
8282
ok unused connection timeout
83+
ok sshd_config match subsystem
8384
test_sshbuf: ...................................................................................................... 103 tests ok
8485
test_sshkey: ........................................................................................................ 104 tests ok
8586
test_sshsig: ........ 8 tests ok

0 commit comments

Comments
 (0)