aboutsummaryrefslogtreecommitdiff
path: root/crypto/openssh/session.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/session.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/session.c')
-rw-r--r--crypto/openssh/session.c70
1 files changed, 37 insertions, 33 deletions
diff --git a/crypto/openssh/session.c b/crypto/openssh/session.c
index 0517d538762a..1dd4b647062b 100644
--- a/crypto/openssh/session.c
+++ b/crypto/openssh/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.348 2026/03/05 05:40:36 djm Exp $ */
+/* $OpenBSD: session.c,v 1.350 2026/06/05 08:53:07 djm Exp $ */
/*
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
* All rights reserved
@@ -1625,21 +1625,22 @@ do_child(struct ssh *ssh, Session *s, const char *command)
exit(1);
} else if (s->is_subsystem == SUBSYSTEM_INT_SFTP) {
extern int optind, optreset;
- int i;
- char *p, *args;
+ int sftp_argc;
+ char **sftp_argv;
setproctitle("%s@%s", s->pw->pw_name, INTERNAL_SFTP_NAME);
- args = xstrdup(command ? command : "sftp-server");
- for (i = 0, (p = strtok(args, " ")); p; (p = strtok(NULL, " ")))
- if (i < ARGV_MAX - 1)
- argv[i++] = p;
- argv[i] = NULL;
+ if (argv_split(command == NULL ? "sftp-server" : command,
+ &sftp_argc, &sftp_argv, 1) != 0) {
+ error("internal error: can't split internal-sftp "
+ "arguments");
+ exit(1);
+ }
optind = optreset = 1;
- __progname = argv[0];
+ __progname = sftp_argv[0];
#ifdef WITH_SELINUX
ssh_selinux_change_context("sftpd_t");
#endif
- exit(sftp_server_main(i, argv, s->pw));
+ exit(sftp_server_main(sftp_argc, sftp_argv, s->pw));
}
fflush(NULL);
@@ -1925,7 +1926,7 @@ static int
session_subsystem_req(struct ssh *ssh, Session *s)
{
struct stat st;
- int r, success = 0;
+ int r, success = 0, found = 0;
char *prog, *cmd, *type;
u_int i;
@@ -1936,31 +1937,34 @@ session_subsystem_req(struct ssh *ssh, Session *s)
s->pw->pw_name);
for (i = 0; i < options.num_subsystems; i++) {
- if (strcmp(s->subsys, options.subsystem_name[i]) == 0) {
- prog = options.subsystem_command[i];
- cmd = options.subsystem_args[i];
- if (strcmp(INTERNAL_SFTP_NAME, prog) == 0) {
- s->is_subsystem = SUBSYSTEM_INT_SFTP;
- debug("subsystem: %s", prog);
- } else {
- if (stat(prog, &st) == -1)
- debug("subsystem: cannot stat %s: %s",
- prog, strerror(errno));
- s->is_subsystem = SUBSYSTEM_EXT;
- debug("subsystem: exec() %s", cmd);
- }
- xasprintf(&type, "session:subsystem:%s",
- options.subsystem_name[i]);
- channel_set_xtype(ssh, s->chanid, type);
- free(type);
- success = do_exec(ssh, s, cmd) == 0;
- break;
+ if (strcmp(s->subsys, options.subsystem_name[i]) != 0)
+ continue;
+ found = 1;
+ prog = options.subsystem_command[i];
+ cmd = options.subsystem_args[i];
+ if (strcmp(INTERNAL_SFTP_NAME, prog) == 0) {
+ s->is_subsystem = SUBSYSTEM_INT_SFTP;
+ debug("subsystem: %s", prog);
+ } else {
+ if (stat(prog, &st) == -1)
+ debug("subsystem: cannot stat %s: %s",
+ prog, strerror(errno));
+ s->is_subsystem = SUBSYSTEM_EXT;
+ debug("subsystem: exec() %s", cmd);
}
+ xasprintf(&type, "session:subsystem:%s",
+ options.subsystem_name[i]);
+ channel_set_xtype(ssh, s->chanid, type);
+ free(type);
+ success = do_exec(ssh, s, cmd) == 0;
+ break;
}
- if (!success)
- logit("subsystem request for %.100s by user %s failed, "
- "subsystem not found", s->subsys, s->pw->pw_name);
+ if (!success) {
+ logit("subsystem request for %.100s by user %s failed, %s",
+ s->subsys, s->pw->pw_name,
+ found ? "execution failed" : "subsystem not found");
+ }
return success;
}