640 Commits

Author SHA1 Message Date
djm@openbsd.org
81ca1451bf upstream: Add experimental support for a composite post-quantum
signature scheme that combines ML-DSA 44 and Ed25519 using the construction
specified in draft-ietf-lamps-pq-composite-sigs. There's also an early draft
documenting use of the integration of this scheme into SSH as
draft-miller-sshm-mldsa44-ed25519-composite-sigs

This scheme is not enabled by default. To you use, you'll need
to add it to HostKeyAlgorithms, PubkeyAcceptedAlgorithms, etc.
Keys may be generated using "ssh-keygen -t mldsa44-ed25519".

The ML-DSA implementation comes from libcrux. Thanks to
Jonas Schneider-Bensch and Jonathan Protzenko for their work to
make this available.

Consensus is that it's time to get this in to allow people to
experiment with it.

feedback markus@ tb@ logan@ deraadt@

OpenBSD-Commit-ID: 85f2d41e3d3374b4e8c28a45a7c92f153c4489e2
2026-06-14 14:27:52 +10:00
djm@openbsd.org
df18979e11 upstream: DNS0x20[1] can randomise the case of domain names returned by
lookup to force some more uniqueness in queries to reduce the likelihood of
spoofing attacks succeeding.

Normally this should be hidden from the user by the resolver, but
in some cases it can leak through. When it does, it can mess up
ssh's CanonicalizePermittedCNAMEs.

Fix this by forcing the name we received from the system resolver to
lowercase.

bz3966, report and fix by Martin D Kealey

[1] https://datatracker.ietf.org/doc/html/draft-vixie-dnsext-dns0x20-00

OpenBSD-Commit-ID: e0b300d3b3af289e053d928380af71949f95bfb0
2026-05-31 16:03:47 +10:00
djm@openbsd.org
1e82d2cfcf upstream: fix client use-after-free on error path if cipher_init()
fails; reported by Qualys Security Advisory Team, ok markus@

OpenBSD-Commit-ID: a8731da0c462b2b9d11314ba505c26ee0cdada83
2026-05-31 15:03:54 +10:00
djm@openbsd.org
76685c9b09 upstream: move username validity check for usernames specified on
the commandline to earlier in main(), specifically before some contexts where
a username with shell characters might be expanded by a %u directive in
ssh_config.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

We continue to recommend against using untrusted input on
the SSH commandline. Mitigations like this are not 100%
guarantees of safety because we can't control every
combination of user shell and configuration where they are
used.

Reported by Florian Kohnhäuser

OpenBSD-Commit-ID: 25ef72223f5ccf1c38d307ae77c23c03f59acc55
2026-04-02 18:53:25 +11:00
djm@openbsd.org
0a0ef45153 upstream: apply the same validity rules to usernames and hostnames
set for ProxyJump/-J on the commandline as we do for destination user/host
names.

Specifically, they are no longer allowed to contain most characters
that have special meaning for common shells. Special characters are
still allowed in ProxyJump commands that are specified in the config
files.

This _reduces_ the chance that shell characters from a hostile -J
option from ending up in a shell execution context.

Don't pass untrusted stuff to the ssh commandline, it's not intended
to be a security boundary. We try to make it safe where we can, but
we can't make guarantees, because we can't know the parsing rules
and special characters for all the shells in the world, nor can we
know what the user does with this data in their ssh_config wrt
percent expansion, LocalCommand, match exec, etc.

While I'm in there, make ProxyJump and ProxyCommand first-match-wins
between each other.

reported by rabbit; ok dtucker@

OpenBSD-Commit-ID: f05ad8a1eb5f6735f9a935a71a90580226759263
2026-03-30 18:50:47 +11:00
djm@openbsd.org
4fe278629c upstream: With IANA codepoints for draft-ietf-sshm-ssh-agent now
allocated, it's safe to start using the standard names for requesting agent
forwarding over the @openssh.com extension names we've used to date.

Support for the standard names is advertised via EXT_INFO. When the
client sees such support it will use the new names preferentially,
but the existing names remain supported unconditionally.

ok markus@

OpenBSD-Commit-ID: 1ab4a0b4de01e81a432875c2b7e5f7357e231af3
2026-03-05 16:45:04 +11:00
dtucker@openbsd.org
2a387ba374 upstream: Replace all remaining instances of u_intXX_t types with the
C99 equivalent uintXX_t types.  ok djm@

OpenBSD-Commit-ID: d9b81151266adb129574ce268af49f14ac23e65b
2026-03-03 21:04:04 +11:00
jsg@openbsd.org
0e35095bab upstream: remove duplicate includes; ok dtucker@
OpenBSD-Commit-ID: 6b9191bc1a0f4320c926d5ccd9f36b09f0f3bcaf
2026-02-18 08:46:28 +11:00
Darren Tucker
9eb778cfde Restore utf8.h removed earlier as it's needed.
... for msetlocale prototype.
2026-02-17 09:12:12 -05:00
jsg@openbsd.org
07c6413e7b upstream: remove unneeded includes; ok dtucker@
OpenBSD-Commit-ID: bba6e85492276c30c7a9d27dfd3c4c55fa033335
2026-02-15 19:49:47 -05:00
djm@openbsd.org
2f51e29b9a upstream: support multiple files in a ssh_config RevokedHostKeys
directive bz3918; ok dtucker

OpenBSD-Commit-ID: 0ad2eacf836f912f347846ab84760799033dd348
2026-02-12 10:30:11 +11:00
dtucker@openbsd.org
3160f2a97e upstream: Add includes used in Portable to reduce diffs.
OpenBSD-Commit-ID: 186c60cf2da0ddb075d5bc4879e87bbd8779b7e4
2026-02-12 10:28:24 +11:00
Darren Tucker
eeb671fa2f Shim <sys/queue.h> and <sys/tree.h>.
This significantly reduces the diff vs upstream making future syncs
less painful.  ok djm@
2026-02-10 13:17:13 +11:00
djm@openbsd.org
daf6bdd34b upstream: add a "ssh -O channels user@host" multiplexing command to
get a running mux process to show information about what channels are
currently open; ok dtucker@ markus@

OpenBSD-Commit-ID: 80bb3953b306a50839f9a4bc5679faebc32e5bb8
2025-12-22 12:51:22 +11:00
dtucker@openbsd.org
eb97fc2b5e upstream: Add an ssh -Oconninfo command
that shows connection information, similar to the ~I escapechar.
This is the first use of the mux extension mechanism, so it should be
both forward and backward compatible: a new client talking to an old
server will not allow the "conninfo" request to be sent, but everything
else should work seamlessly.  feedback and ok djm@

OpenBSD-Commit-ID: 50f047a85da277360558cabdfed59cb66f754341
2025-12-05 18:05:44 +11:00
dtucker@openbsd.org
d9955e4571 upstream: Remove calls to OpenSSL_add_all_algorithms()
and ERR_load_crypto_strings(). These are no-ops in LibreSSL, and in
Portable have been mostly replaced by a call to OPENSSL_init_crypto()
in the compat layer.  ok tb@

OpenBSD-Commit-ID: 4c3e0af10fe276766054eda34428a37a5606d3ea
2025-11-13 22:08:28 +11:00
djm@openbsd.org
8235dc3d82 upstream: fix some one-off leaks in ssh.c; ok dtucker@
OpenBSD-Commit-ID: bf3c27ffe4b3cccb6553b554ec4c04929065a2bc
2025-09-25 17:07:30 +10:00
djm@openbsd.org
ee99f6e93e upstream: memleak of certificate path; ok dtucker@
OpenBSD-Commit-ID: 90dc5390f2756ba339e2e6df54d4b8651d64c1e7
2025-09-15 16:13:23 +10:00
Darren Tucker
ea586edbcb Create replacement sys/stat.h if needed.
Remove #ifdef HAVE_SYS_STAT_H wrapper.  ok djm@
2025-09-05 17:50:18 +10:00
Darren Tucker
5f09983d1e Create replacement paths.h if needed.
Remove #ifdef HAVE_PATHS_H wrapper.  ok djm@
2025-09-05 17:24:50 +10:00
djm@openbsd.org
35d5917652 upstream: Improve rules for %-expansion of username.
Usernames passed on the commandline will no longer be subject to
% expansion. Some tools invoke ssh with connection information
(i.e. usernames and host names) supplied from untrusted sources.
These may contain % expansion sequences which could yield
unexpected results.

Since openssh-9.6, all usernames have been subject to validity
checking. This change tightens the validity checks by refusing
usernames that include control characters (again, these can cause
surprises when supplied adversarially).

This change also relaxes the validity checks in one small way:
usernames supplied via the configuration file as literals (i.e.
include no % expansion characters) are not subject to these
validity checks. This allows usernames that contain arbitrary
characters to be used, but only via configuration files. This
is done on the basis that ssh's configuration is trusted.

Pointed out by David Leadbeater, ok deraadt@

OpenBSD-Commit-ID: e2f0c871fbe664aba30607321575e7c7fc798362
2025-09-04 10:30:37 +10:00
djm@openbsd.org
a9a3f025d7 upstream: remove experimental support for XMSS keys;
ok deraadt markus

OpenBSD-Commit-ID: 38eaf4df6189acad9e46eddf7cf32d7f6d07df35
2025-08-29 13:58:40 +10:00
djm@openbsd.org
289239046b upstream: Make ssh(1) and sshd(8) set IP QoS (aka IP_TOS, IPV6_TCLASS)
continually at runtime based on what sessions/channels are open.

Previously, ssh(1) and sshd(8) would pick a QoS value when they
were started and use it for the whole connection. This could
produce suboptimal choices for the QoS value, e.g. for multiplexed
sessions that started interactive but picked up a sftp client,
or sessions that moved large amounts of data via port forwarding.

Now the QoS value will change to the non-interactive IPQoS whenever
a "non-interactive" channel is open; basically any channel that lacks
a tty other than agent forwarding.

This is important now that the default interactive IPQoS is EF
(Expedited Forwarding), as many networks are configured to allow
only relatively small amounts of traffic of this class and they will
aggressively deprioritise the entire connection if this is exceeded.

NB. because ssh(1) and sshd(8) now change IP_TOS/IPV6_TCLASS
continually via setsockopt(), this commit requires a recent pledge(2)
change that landed recently in the OpenBSD kernel. Please ensure
you have updated to a kernel from within the last two weeks before
updating OpenSSH.

with job@ deraadt@

OpenBSD-Commit-ID: 325fc41717eecdf5e4b534bfa8d66817425b840f
2025-08-18 13:57:44 +10:00
djm@openbsd.org
5ba8391d69 upstream: better debug diagnostics when loading keys. Will now list
key fingerprint and algorithm (not just algorithm number) as well as making
it explicit which keys didn't load.

OpenBSD-Commit-ID: ee3e77a0271ab502e653922c6d161b1e091f8fee
2025-06-24 19:25:17 +10:00
djm@openbsd.org
a32d28d792 upstream: finally remove DSA signature support from OpenSSH.
feedback/ok tb@, ok deraadt@

OpenBSD-Commit-ID: bfe6ee73c1b676c81a2901030c791f8ec888228f
2025-05-07 14:20:14 +10:00
djm@openbsd.org
dd73459e35 upstream: oops, I accidentally backed out the typo fix
OpenBSD-Commit-ID: f485f79bf3e9ebbe1de13ac96150cf458956cfd8
2025-04-09 11:25:08 +10:00
djm@openbsd.org
0cb9458919 upstream: typo
OpenBSD-Commit-ID: f912725c7d303720706b3ccfb2cb846d46296d13
2025-04-09 11:25:08 +10:00
djm@openbsd.org
985d8cbcd3 upstream: typo
OpenBSD-Commit-ID: 6e683e13e72bf1e43bbd3bbc6a8332d5a98bdc99
2025-04-09 09:12:26 +10:00
dtucker@openbsd.org
b49875428c upstream: Add %-token and environment variable expansion to SetEnv.
feedback deraadt@ jmc@, nits and ok djm@

OpenBSD-Commit-ID: 2f6e5070481cb73e6f35fd1c6608c1eeff88a5c1
2025-03-03 18:05:05 +11:00
djm@openbsd.org
c94138d02a upstream: whitespace
OpenBSD-Commit-ID: 1bd8953a37451ef7e0991f9fceec5e8005fe986a
2025-03-02 22:06:31 +11:00
dtucker@openbsd.org
65d2c59628 upstream: Make a copy of the user when handling ssh -l, so that
later during User token expansion we don't end up freeing a member of argv.
Spotted by anton@'s regress tests.

OpenBSD-Commit-ID: 2f671a4f5726b66d123b88b1fdd1a90581339955
2025-03-02 22:06:30 +11:00
dtucker@openbsd.org
bd30cf784d upstream: Allow %-token and environment variable expansion in User,
with the exception of %r and %C which are self-referential.  Requested in
bz#3477, ok djm@, man page improvements jmc@

OpenBSD-Commit-ID: caeb46251ee073662f6f5864c6f7b92d8ac80fa8
2025-03-02 22:06:30 +11:00
deraadt@openbsd.org
487cf4c18c upstream: Also prohibit , (comma) in hostnames, proposed by David
Leadbeater ok djm millert

OpenBSD-Commit-ID: 2837fa31dc6e81976f510f0a259edaa559b20b07
2025-02-25 20:57:25 +11:00
djm@openbsd.org
caa3c0c770 upstream: "Match command ..." support for ssh_config to allow
matching on the remote command specified on the commandline.

Also relaxes matching rules for `Match tagged` to allow
`Match tagged ""` to match an empty tag value. This also works
for command.

ok markus@

OpenBSD-Commit-ID: 00dcfea425bf58d824bf5e3464cfc2409121b60d
2025-02-15 13:11:33 +11:00
djm@openbsd.org
aa1409e7a0 upstream: include arguments the command was invoked with, and
operating system name, version and architecture in startup debugging output;
ok dtucker

OpenBSD-Commit-ID: 2a509d319aaf31a6bf9998e1842832883fbc3edd
2025-02-11 10:30:30 +11:00
djm@openbsd.org
9a9ffee6e1 upstream: support VersionAddendum in the client, mirroring the
option of the same name in the server; bz2745 ok dtucker@

OpenBSD-Commit-ID: 6ff7905b3f9806649bde750515786553fb89cdf4
2024-12-07 21:16:02 +11:00
djm@openbsd.org
d01ee7a88c upstream: require control-escape character sequences passed via the '-e
^x' commandline to be exactly two characters long. Avoids one by OOB read if
ssh is invoked as "ssh -e^ ..."

Spotted by Maciej Domanski in GHPR368

OpenBSD-Commit-ID: baa72bc60898fc5639e6c62de7493a202c95823d
2024-10-18 16:04:16 +11:00
djm@openbsd.org
4e838120a7 upstream: make DSA key support compile-time optional, defaulting to
on

ok markus@

OpenBSD-Commit-ID: 4f8e98fc1fd6de399d0921d5b31b3127a03f581d
2024-01-11 15:46:22 +11:00
djm@openbsd.org
7ef3787c84 upstream: ban user/hostnames with most shell metacharacters
This makes ssh(1) refuse user or host names provided on the
commandline that contain most shell metacharacters.

Some programs that invoke ssh(1) using untrusted data do not filter
metacharacters in arguments they supply. This could create
interactions with user-specified ProxyCommand and other directives
that allow shell injection attacks to occur.

It's a mistake to invoke ssh(1) with arbitrary untrusted arguments,
but getting this stuff right can be tricky, so this should prevent
most obvious ways of creating risky situations. It however is not
and cannot be perfect: ssh(1) has no practical way of interpreting
what shell quoting rules are in use and how they interact with the
user's specified ProxyCommand.

To allow configurations that use strange user or hostnames to
continue to work, this strictness is applied only to names coming
from the commandline. Names specified using User or Hostname
directives in ssh_config(5) are not affected.

feedback/ok millert@ markus@ dtucker@ deraadt@

OpenBSD-Commit-ID: 3b487348b5964f3e77b6b4d3da4c3b439e94b2d9
2023-12-19 01:53:40 +11:00
djm@openbsd.org
f59a94e22e upstream: don't dereference NULL pointer when hashing jumphost
OpenBSD-Commit-ID: 251c0263e1759a921341c7efe7f1d4c73e1c70f4
2023-10-12 13:58:19 +11:00
djm@openbsd.org
98fc34df83 upstream: add %j token that expands to the configured ProxyJump
hostname (or the empty string if this option is not being used). bz3610, ok
dtucker

OpenBSD-Commit-ID: ce9983f7efe6a178db90dc5c1698df025df5e339
2023-10-12 13:19:41 +11:00
djm@openbsd.org
531b27a006 upstream: sync usage() with ssh.1; spotted by kn@
OpenBSD-Commit-ID: 191a85639477dcb5fa1616d270d93b7c8d5c1dfd
2023-10-12 13:19:40 +11:00
djm@openbsd.org
a752a6c0e1 upstream: add ChannelTimeout support to the client, mirroring the
same option in the server. ok markus@

OpenBSD-Commit-ID: 55630b26f390ac063980cfe7ad8c54b03284ef02
2023-10-12 10:00:13 +11:00
djm@openbsd.org
43254b326a upstream: set interactive mode for ControlPersist sessions if they
originally requested a tty; enables keystroke timing obfuscation for most
ControlPersist sessions. Spotted by naddy@

OpenBSD-Commit-ID: 72783a26254202e2f3f41a2818a19956fe49a772
2023-09-04 10:09:52 +10:00
djm@openbsd.org
2d34205dab upstream: make ssh -f (fork after authentication) work properly in
multiplexed cases (inc. ControlPersist). bz3589 bz3589 Based on patches by
Peter Chubb; ok dtucker@

OpenBSD-Commit-ID: a7a2976a54b93e6767dc846b85647e6ec26969ac
2023-07-27 09:11:22 +10:00
jmc@openbsd.org
6d6e185ba2 upstream: - add -P to usage() - sync the arg name to -J in usage()
with that in ssh.1 - reformat usage() to match what "man ssh" does on 80width

OpenBSD-Commit-ID: 5235dd7aa42e5bf90ae54579d519f92fc107036e
2023-07-17 16:23:03 +10:00
djm@openbsd.org
919bc3d3b7 upstream: Add support for configuration tags to ssh(1).
This adds a ssh_config(5) "Tag" directive and corresponding
"Match tag" predicate that may be used to select blocks of
configuration similar to the pf.conf(5) keywords of the same
name.

ok markus

OpenBSD-Commit-ID: dc08358e70e702b59ac3e591827e5a96141b06a3
2023-07-17 14:53:53 +10:00
dlg@openbsd.org
94842bfe9b upstream: add support for unix domain sockets to ssh -W
ok djm@ dtucker@

OpenBSD-Commit-ID: 3e6d47567b895c7c28855c7bd614e106c987a6d8
2023-07-07 08:20:25 +10:00
djm@openbsd.org
4e73cd0f4a upstream: make ssh -Q CASignatureAlgorithms only list signature
algorithms that are valid for CA signing. Previous behaviour was to list all
signing algorithms, including certificate algorithms (OpenSSH certificates do
not support CA chains). part of bz3577; ok dtucker@

OpenBSD-Commit-ID: 99c2b072dbac0f44fd1f2269e3ff6c1b5d7d3e59
2023-06-21 15:13:55 +10:00
djm@openbsd.org
c8eb394175 upstream: Check for ProxyJump=none in CanonicalizeHostname logic.
Previously ssh would incorrectly refuse to canonicalise the hostname
if ProxyJump was explicitly set to "none" when CanonicalizeHostname=yes

bz3567; ok dtucker

OpenBSD-Commit-ID: 80a58e43c3a32f97361282f756ec8d3f37989efd
2023-04-26 14:38:21 +10:00