-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenssh-10.4p1-XCPNG-CVE-2026-60000.patch
More file actions
138 lines (123 loc) · 4.56 KB
/
Copy pathopenssh-10.4p1-XCPNG-CVE-2026-60000.patch
File metadata and controls
138 lines (123 loc) · 4.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
Origin: upstream, https://github.com/openssh/openssh-portable/commit/5d04ca6af739b82fd30d84d2783ca802ebfa1192
Backport notes:
- Only the "version identifier/RCS ID" in the header has been updated
to reflect our current base file.
From 5d04ca6af739b82fd30d84d2783ca802ebfa1192 Mon Sep 17 00:00:00 2001
From: "djm@openbsd.org" <djm@openbsd.org>
Date: Mon, 6 Jul 2026 07:53:30 +0000
Subject: [PATCH] upstream: Fix multiple RFC 4462 (GSSAPIAuthentication)
compliance
problems
1) Remove an early failure return for GSSAPI authentication attempts
made for invalid accounts that yielded different behaviour for
valid vs invalid accounts.
2) Fix a situation where some GSSAPI requestes were not correctly
subjected to MaxAuthTries.
3) Fix a moderate pre-authentication resource DoS related to #2.
Add missing logging for error cases.
Report and fixes from Manfred Kaiser, milCERT AT
OpenBSD-Commit-ID: ca0acdd64eea435d6f89534538a9eb404a5629d3
Backported-by: Lucas Ravagnier <lucas.ravagnier@vates.tech>
---
auth2-gss.c | 53 ++++++++++++++++++++++++-----------------------------
1 file changed, 24 insertions(+), 29 deletions(-)
diff --git a/auth2-gss.c b/auth2-gss.c
index 901ba52..9c25ab2 100644
--- a/auth2-gss.c
+++ b/auth2-gss.c
@@ -154,12 +154,6 @@ userauth_gssapi(struct ssh *ssh, const char *method)
return (0);
}
- if (!authctxt->valid || authctxt->user == NULL) {
- debug2_f("disabled because of invalid user");
- free(doid);
- return (0);
- }
-
if (GSS_ERROR(mm_ssh_gssapi_server_ctx(&ctxt, &goid))) {
if (ctxt != NULL)
ssh_gssapi_delete_ctx(&ctxt);
@@ -221,8 +215,14 @@ input_gssapi_token(int type, u_int32_t plen, struct ssh *ssh)
(r = sshpkt_send(ssh)) != 0)
fatal_fr(r, "send ERRTOK packet");
}
+ logit("Failed gssapi-with-mic for %s%.100s "
+ "from %.200s port %d ssh2",
+ authctxt->valid ? "" : "invalid user ",
+ authctxt->user,
+ ssh_remote_ipaddr(ssh), ssh_remote_port(ssh));
authctxt->postponed = 0;
ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_TOKEN, NULL);
+ ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_ERRTOK, NULL);
userauth_finish(ssh, 0, "gssapi-with-mic", NULL);
} else {
if (send_tok.length != 0) {
@@ -234,14 +234,18 @@ input_gssapi_token(int type, u_int32_t plen, struct ssh *ssh)
fatal_fr(r, "send TOKEN packet");
}
if (maj_status == GSS_S_COMPLETE) {
- ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_TOKEN, NULL);
- if (flags & GSS_C_INTEG_FLAG)
- ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_MIC,
+ ssh_dispatch_set(ssh,
+ SSH2_MSG_USERAUTH_GSSAPI_TOKEN, NULL);
+ /* note: keep ERRTOK handler as per RFC 4462 s3.4 */
+ if (flags & GSS_C_INTEG_FLAG) {
+ ssh_dispatch_set(ssh,
+ SSH2_MSG_USERAUTH_GSSAPI_MIC,
&input_gssapi_mic);
- else
+ } else {
ssh_dispatch_set(ssh,
SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE,
&input_gssapi_exchange_complete);
+ }
}
}
@@ -253,10 +257,6 @@ static int
input_gssapi_errtok(int type, u_int32_t plen, struct ssh *ssh)
{
Authctxt *authctxt = ssh->authctxt;
- Gssctxt *gssctxt;
- gss_buffer_desc send_tok = GSS_C_EMPTY_BUFFER;
- gss_buffer_desc recv_tok;
- OM_uint32 maj_status;
int r;
u_char *p;
size_t len;
@@ -264,26 +264,21 @@ input_gssapi_errtok(int type, u_int32_t plen, struct ssh *ssh)
if (authctxt == NULL)
fatal("No authentication or GSSAPI context");
- gssctxt = authctxt->methoddata;
- if ((r = sshpkt_get_string(ssh, &p, &len)) != 0 ||
+ /* Minimal error handling - just cancel auth and return FAILURE */
+ if ((r = sshpkt_get_string_direct(ssh, NULL, NULL)) != 0 ||
(r = sshpkt_get_end(ssh)) != 0)
fatal_fr(r, "parse packet");
- recv_tok.value = p;
- recv_tok.length = len;
-
- /* Push the error token into GSSAPI to see what it says */
- maj_status = mm_ssh_gssapi_accept_ctx(gssctxt, &recv_tok,
- &send_tok, NULL);
-
- free(recv_tok.value);
- /* We can't return anything to the client, even if we wanted to */
+ logit("Failed gssapi-with-mic for %s%.100s from %.200s port %d ssh2",
+ authctxt->valid ? "" : "invalid user ",
+ authctxt->user,
+ ssh_remote_ipaddr(ssh), ssh_remote_port(ssh));
+ authctxt->postponed = 0;
ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_TOKEN, NULL);
ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_ERRTOK, NULL);
-
- /* The client will have already moved on to the next auth */
-
- gss_release_buffer(&maj_status, &send_tok);
+ ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_MIC, NULL);
+ ssh_dispatch_set(ssh, SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE, NULL);
+ userauth_finish(ssh, 0, "gssapi-with-mic", NULL);
return 0;
}
--
2.54.0