aboutsummaryrefslogtreecommitdiff
path: root/crypto/openssh/monitor_wrap.c
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2026-07-09 17:17:11 +0000
committerEd Maste <emaste@FreeBSD.org>2026-07-09 17:17:11 +0000
commitbb5c77e9d281d6def6835d48249898764bc6a5fe (patch)
tree566105bcbb97c3f87494801d3dfbf6d18e29cfbe /crypto/openssh/monitor_wrap.c
parent3defe8195684c3ee4cf5295a58967e3face8dce1 (diff)
parent3838aee84536f5957d08f2914aa03181f9c41c89 (diff)
OpenSSH: Update to 10.4p1
Full release notes are available at https://www.openssh.com/txt/release-10.4 Selected highlights from the release notes: Potentially-incompatible changes -------------------------------- * sshd(8): configuration dump mode ("sshd -G") now writes directives in mixed case (e.g. "PubkeyAuthentication") whereas previously it emitted only lower-case names. * ssh(1), sshd(8): make the transport protocol stricter by disconnecting if the peer sends non-KEX messages during a post- authentication key re-exchange. Previously a malicious peer could continue sending non-key exchange messages without penalty. These would be buffered, causing memory to be wasted up until the connection terminated or the server/client hit a memory limit. Implementations that do not restrict messages sent during key exchange as per RFC4253 section 7.1 may be disconnected. Reported by Marko Jevtic. Changes since OpenSSH 10.3 ========================== This release contains a number of security fixes as well as general bugfixes and a couple of new features. Security ======== * sftp(1): when downloading files on the command-line using "sftp host:/path .", a malicious server could cause the file to be downloaded to an unexpected location. This issue was identified by the Swival Security Scanner. * scp(1): when copying files between two remote destinations, do not allow a malicious server to write files to the parent directory of the intended target directory. This issue was identified by the Swival Security Scanner. * sshd(8): DisableForwarding=yes didn't override PermitTunnel=yes as it was documented to do. Note that PermitTunnel is not enabled by default. Reported independently by Huzaifa Sidhpurwala of Redhat and Marko Jevtic. * sshd(8): avoid a potential pre-authentication denial of service when GSSAPIAuthentication was enabled (this feature is off by default). This was not mitigated by MaxAuthTries, but would be penalised by PerSourcePenalties. This was reported by Manfred Kaiser of the milCERT AT (Austrian Ministry of Defence). * sshd(8): fix a number of cases where the minimum authentication delay was not being enforced. Reported by the Orange Cyberdefense Vulnerability Team. * ssh(1): fix a possible client-side use-after-free if the server changes its host key during a key reexchange. This was reported by Zhenpeng (Leo) Lin of Depthfirst. New features ------------ * All: add experimental support for a composite post-quantum signature scheme that combines ML-DSA 44 and Ed25519 as specified in draft-miller-sshm-mldsa44-ed25519-composite-sigs. This scheme is not enabled by default. To use it, you'll need to add it to HostKeyAlgorithms, PubkeyAcceptedAlgorithms, etc. Keys may be generated using "ssh-keygen -t mldsa44-ed25519". Bugfixes -------- * sshd(8): avoid sending observably different messages for valid vs invalid users in GSSAPIAuthentication (disabled by default). * ssh(1), sshd(8): fix several bugs that incorrectly classified bulk traffic as interactive. bz3972, bz3958 * ssh-keygen(1), ssh-add(1): skip unsupported key types when downloading resident keys from a FIDO token. Previously, downloads would abort when one was encountered. GHPR657 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D58083
Diffstat (limited to 'crypto/openssh/monitor_wrap.c')
-rw-r--r--crypto/openssh/monitor_wrap.c84
1 files changed, 16 insertions, 68 deletions
diff --git a/crypto/openssh/monitor_wrap.c b/crypto/openssh/monitor_wrap.c
index 81596a4cc66b..e2b9a2802898 100644
--- a/crypto/openssh/monitor_wrap.c
+++ b/crypto/openssh/monitor_wrap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: monitor_wrap.c,v 1.146 2026/03/02 02:40:15 djm Exp $ */
+/* $OpenBSD: monitor_wrap.c,v 1.147 2026/05/31 11:30:50 djm Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* Copyright 2002 Markus Friedl <markus@openbsd.org>
@@ -302,55 +302,20 @@ mm_sshkey_sign(struct ssh *ssh, struct sshkey *key, u_char **sigp, size_t *lenp,
void
mm_decode_activate_server_options(struct ssh *ssh, struct sshbuf *m)
{
- const u_char *p;
- size_t len;
- u_int i;
- ServerOptions *newopts;
+ struct sshbuf *config;
int r;
+ u_int i;
- if ((r = sshbuf_get_string_direct(m, &p, &len)) != 0)
+ if ((r = sshbuf_froms(m, &config)) != 0)
fatal_fr(r, "parse opts");
- if (len != sizeof(*newopts))
- fatal_f("option block size mismatch");
- newopts = xcalloc(sizeof(*newopts), 1);
- memcpy(newopts, p, sizeof(*newopts));
-
-#define M_CP_STROPT(x) do { \
- if (newopts->x != NULL && \
- (r = sshbuf_get_cstring(m, &newopts->x, NULL)) != 0) \
- fatal_fr(r, "parse %s", #x); \
- } while (0)
-#define M_CP_STRARRAYOPT(x, nx, clobber) do { \
- newopts->x = newopts->nx == 0 ? \
- NULL : xcalloc(newopts->nx, sizeof(*newopts->x)); \
- for (i = 0; i < newopts->nx; i++) { \
- if ((r = sshbuf_get_cstring(m, \
- &newopts->x[i], NULL)) != 0) \
- fatal_fr(r, "parse %s", #x); \
- } \
- } while (0)
- /* See comment in servconf.h */
- COPY_MATCH_STRING_OPTS();
-#undef M_CP_STROPT
-#undef M_CP_STRARRAYOPT
+ if ((r = deserialise_server_options(config, &options)) != 0)
+ fatal_fr(r, "deserialise_server_options");
+ sshbuf_free(config);
- copy_set_server_options(&options, newopts, 1);
log_change_level(options.log_level);
log_verbose_reset();
for (i = 0; i < options.num_log_verbose; i++)
log_verbose_add(options.log_verbose[i]);
-
- /* use the macro hell to clean up too */
-#define M_CP_STROPT(x) free(newopts->x)
-#define M_CP_STRARRAYOPT(x, nx, clobber) do { \
- for (i = 0; i < newopts->nx; i++) \
- free(newopts->x[i]); \
- free(newopts->x); \
- } while (0)
- COPY_MATCH_STRING_OPTS();
-#undef M_CP_STROPT
-#undef M_CP_STRARRAYOPT
- free(newopts);
}
#define GETPW(b, id) \
@@ -885,22 +850,19 @@ mm_terminate(void)
/* Request state information */
void
-mm_get_state(struct ssh *ssh, struct include_list *includes,
- struct sshbuf *conf, struct sshbuf **confdatap,
+mm_get_state(struct ssh *ssh,
+ ServerOptions *opts, struct sshbuf **confdatap,
uint64_t *timing_secretp,
struct sshbuf **hostkeysp, struct sshbuf **keystatep,
u_char **pw_namep,
struct sshbuf **authinfop, struct sshbuf **auth_optsp)
{
- struct sshbuf *m, *inc;
- u_char *cp;
- size_t len;
+ struct sshbuf *m, *config;
int r;
- struct include_item *item;
debug3_f("entering");
- if ((m = sshbuf_new()) == NULL || (inc = sshbuf_new()) == NULL)
+ if ((m = sshbuf_new()) == NULL || (config = sshbuf_new()) == NULL)
fatal_f("sshbuf_new failed");
mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_STATE, m);
@@ -909,12 +871,11 @@ mm_get_state(struct ssh *ssh, struct include_list *includes,
mm_request_receive_expect(pmonitor->m_recvfd,
MONITOR_ANS_STATE, m);
- if ((r = sshbuf_get_string(m, &cp, &len)) != 0 ||
+ if ((r = sshbuf_froms(m, &config)) != 0 ||
(r = sshbuf_get_u64(m, timing_secretp)) != 0 ||
(r = sshbuf_froms(m, hostkeysp)) != 0 ||
(r = sshbuf_get_stringb(m, ssh->kex->server_version)) != 0 ||
- (r = sshbuf_get_stringb(m, ssh->kex->client_version)) != 0 ||
- (r = sshbuf_get_stringb(m, inc)) != 0)
+ (r = sshbuf_get_stringb(m, ssh->kex->client_version)) != 0)
fatal_fr(r, "parse config");
/* postauth */
@@ -926,24 +887,11 @@ mm_get_state(struct ssh *ssh, struct include_list *includes,
(r = sshbuf_froms(m, auth_optsp)) != 0)
fatal_fr(r, "parse config postauth");
}
+ if ((r = deserialise_server_options(config, opts)) != 0)
+ fatal_fr(r, "deserialise_server_options");
- if (conf != NULL && (r = sshbuf_put(conf, cp, len)))
- fatal_fr(r, "sshbuf_put");
-
- while (sshbuf_len(inc) != 0) {
- item = xcalloc(1, sizeof(*item));
- if ((item->contents = sshbuf_new()) == NULL)
- fatal_f("sshbuf_new failed");
- if ((r = sshbuf_get_cstring(inc, &item->selector, NULL)) != 0 ||
- (r = sshbuf_get_cstring(inc, &item->filename, NULL)) != 0 ||
- (r = sshbuf_get_stringb(inc, item->contents)) != 0)
- fatal_fr(r, "parse includes");
- TAILQ_INSERT_TAIL(includes, item, entry);
- }
-
- free(cp);
sshbuf_free(m);
- sshbuf_free(inc);
+ sshbuf_free(config);
debug3_f("done");
}