idnits 2.17.1
draft-bider-ssh-quic-05.txt:
Checking boilerplate required by RFC 5378 and the IETF Trust (see
https://trustee.ietf.org/license-info):
----------------------------------------------------------------------------
No issues found here.
Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt:
----------------------------------------------------------------------------
No issues found here.
Checking nits according to https://www.ietf.org/id-info/checklist :
----------------------------------------------------------------------------
** There is 1 instance of too long lines in the document, the longest one
being 3 characters in excess of 72.
** The abstract seems to contain references ([QUIC], [RFC4251]), which it
shouldn't. Please replace those with straight textual mentions of the
documents in question.
Miscellaneous warnings:
----------------------------------------------------------------------------
== The copyright year in the IETF Trust and authors Copyright Line does not
match the current year
== Line 386 has weird spacing: '...ort-str clie...'
== Line 387 has weird spacing: '...ort-str serv...'
== Line 396 has weird spacing: '...ort-str trus...'
== Line 400 has weird spacing: '...ort-str clie...'
== Line 405 has weird spacing: '...ort-str quic...'
== (21 more instances...)
-- The document date (12 July 2020) is 1385 days in the past. Is this
intentional?
Checking references for intended status: Informational
----------------------------------------------------------------------------
-- Looks like a reference, but probably isn't: '16' on line 193
== Unused Reference: 'RFC4250' is defined on line 1462, but no explicit
reference was found in the text
== Outdated reference: A later version (-34) exists of
draft-ietf-quic-transport-29
Summary: 2 errors (**), 0 flaws (~~), 9 warnings (==), 2 comments (--).
Run idnits with the --verbose option for more detailed information about
the items above.
--------------------------------------------------------------------------------
2 Internet Engineering Task Force d. bider
3 Internet-Draft Bitvise Limited
4 Intended status: Informational 12 July 2020
5 Expires: 13 January 2021
7 QUIC-based UDP Transport for Secure Shell (SSH)
8 draft-bider-ssh-quic-05
10 Abstract
12 The Secure Shell protocol (SSH) [RFC4251] is widely used for purposes
13 including secure remote administration, file transfer using SFTP and
14 SCP, and encrypted tunneling of TCP connections. Because it is based
15 on TCP, SSH suffers similar problems as motivate the HTTP protocol to
16 transition to UDP-based QUIC [QUIC]. These include: unauthenticated
17 network intermediaries can trivially disconnect SSH sessions; SSH
18 connections are lost when mobile clients change IP addresses;
19 performance limitations in OS-based TCP stacks; many round-trips to
20 establish a connection; duplicate flow control on the level of the
21 connection as well as channels. This memo specifies SSH key exchange
22 over UDP and leverages QUIC to provide a UDP-based transport.
24 Status of This Memo
26 This Internet-Draft is submitted in full conformance with the
27 provisions of BCP 78 and BCP 79.
29 Internet-Drafts are working documents of the Internet Engineering
30 Task Force (IETF). Note that other groups may also distribute
31 working documents as Internet-Drafts. The list of current Internet-
32 Drafts is at https://datatracker.ietf.org/drafts/current/.
34 Internet-Drafts are draft documents valid for a maximum of six months
35 and may be updated, replaced, or obsoleted by other documents at any
36 time. It is inappropriate to use Internet-Drafts as reference
37 material or to cite them other than as "work in progress."
39 This Internet-Draft will expire on 13 January 2021.
41 Copyright Notice
43 Copyright (c) 2020 IETF Trust and the persons identified as the
44 document authors. All rights reserved.
46 This document is subject to BCP 78 and the IETF Trust's Legal
47 Provisions Relating to IETF Documents (https://trustee.ietf.org/
48 license-info) in effect on the date of publication of this document.
49 Please review these documents carefully, as they describe your rights
50 and restrictions with respect to this document. Code Components
51 extracted from this document must include Simplified BSD License text
52 as described in Section 4.e of the Trust Legal Provisions and are
53 provided without warranty as described in the Simplified BSD License.
55 Table of Contents
57 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3
58 1.1. Requirements Terminology . . . . . . . . . . . . . . . . 3
59 2. SSH/QUIC key exchange . . . . . . . . . . . . . . . . . . . . 3
60 2.1. Distinguishing SSH key exchange from QUIC datagrams . . . 3
61 2.2. Wire Encoding . . . . . . . . . . . . . . . . . . . . . . 4
62 2.3. Obfuscated Envelope . . . . . . . . . . . . . . . . . . . 4
63 2.4. Packet Size Limits . . . . . . . . . . . . . . . . . . . 5
64 2.5. Required QUIC Versions and TLS Cipher Suites . . . . . . 5
65 2.6. Random Elements . . . . . . . . . . . . . . . . . . . . . 6
66 2.7. Errors in Key Exchange . . . . . . . . . . . . . . . . . 7
67 2.7.1. "disc-reason" Extension Pair . . . . . . . . . . . . 8
68 2.7.2. "err-desc" Extension Pair . . . . . . . . . . . . . . 8
69 2.8. SSH_QUIC_INIT . . . . . . . . . . . . . . . . . . . . . . 8
70 2.8.1. Extensibility . . . . . . . . . . . . . . . . . . . . 11
71 2.9. SSH_QUIC_REPLY . . . . . . . . . . . . . . . . . . . . . 13
72 2.9.1. Error Reply . . . . . . . . . . . . . . . . . . . . . 16
73 2.9.2. Extensibility . . . . . . . . . . . . . . . . . . . . 16
74 2.10. SSH_QUIC_CANCEL . . . . . . . . . . . . . . . . . . . . . 18
75 2.10.1. Extensibility . . . . . . . . . . . . . . . . . . . 18
76 3. Key Exchange Methods . . . . . . . . . . . . . . . . . . . . 19
77 3.1. Required Key Exchange Methods . . . . . . . . . . . . . . 20
78 3.2. Example 1: "curve25519-sha256" . . . . . . . . . . . . . 21
79 3.3. Example 2: "diffie-hellman-group14-sha256" . . . . . . . 21
80 4. SSH_MSG_EXT_INFO and the SSH Version String . . . . . . . . . 22
81 4.1. "ssh-version" . . . . . . . . . . . . . . . . . . . . . . 23
82 4.2. "no-flow-control" . . . . . . . . . . . . . . . . . . . . 23
83 4.3. "delay-compression" . . . . . . . . . . . . . . . . . . . 23
84 5. QUIC Session Setup . . . . . . . . . . . . . . . . . . . . . 24
85 5.1. Shared Secrets . . . . . . . . . . . . . . . . . . . . . 24
86 6. Adaptation of SSH to QUIC Streams . . . . . . . . . . . . . . 25
87 6.1. SSH/QUIC Packet Format . . . . . . . . . . . . . . . . . 25
88 6.1.1. Compression . . . . . . . . . . . . . . . . . . . . . 25
89 6.2. Use of QUIC Streams . . . . . . . . . . . . . . . . . . . 26
90 6.3. Packet Sequence Numbers . . . . . . . . . . . . . . . . . 26
91 6.4. Channel IDs . . . . . . . . . . . . . . . . . . . . . . . 26
92 6.5. Disconnection . . . . . . . . . . . . . . . . . . . . . . 27
93 6.6. Prohibited SSH Packets . . . . . . . . . . . . . . . . . 27
94 6.7. Global SSH Packets . . . . . . . . . . . . . . . . . . . 27
95 6.8. SSH Channel Packets . . . . . . . . . . . . . . . . . . . 28
96 6.9. Closing a Channel . . . . . . . . . . . . . . . . . . . . 30
98 7. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 30
99 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 30
100 9. Security Considerations . . . . . . . . . . . . . . . . . . . 31
101 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 31
102 10.1. Normative References . . . . . . . . . . . . . . . . . . 31
103 10.2. Informative References . . . . . . . . . . . . . . . . . 32
104 Appendix A. Generating Random Lengths . . . . . . . . . . . . . 33
105 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 33
107 1. Introduction
109 THIS DOCUMENT IS AN EARLY VERSION AND IS A WORK IN PROGRESS.
111 NON-LATEST DRAFT VERSIONS MUST BE DISREGARDED.
113 IMPLEMENTATION AT THIS STAGE IS EXPERIMENTAL.
115 CONTACT THE AUTHOR IF YOU INTEND TO IMPLEMENT.
117 This memo specifies SSH key exchange over UDP, and then leverages
118 QUIC to provide a UDP-based transport for SSH. QUIC's use of the TLS
119 handshake is replaced with a one-roundtrip SSH/QUIC key exchange.
120 The SSH Authentication Protocol [RFC4252] is then conducted over QUIC
121 stream 0, and the SSH Connection Protocol [RFC4254] is modified to
122 use QUIC streams.
124 1.1. Requirements Terminology
126 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
127 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
128 "OPTIONAL" in this document are to be interpreted as described in
129 BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all
130 capitals, as shown here.
132 2. SSH/QUIC key exchange
134 2.1. Distinguishing SSH key exchange from QUIC datagrams
136 UDP datagrams which form the SSH/QUIC key exchange are sent between
137 the same client and server IP addresses and ports as QUIC datagrams.
138 It is therefore necessary for clients and servers to distinguish SSH
139 key exchange datagrams from QUIC datagrams.
141 A distinction is allowed by that SSH/QUIC only requires the sending
142 of QUIC Short Header Packets. Therefore, all UDP datagrams where the
143 first byte has its high bit set MUST be handled as part of an SSH/
144 QUIC key exchange.
146 2.2. Wire Encoding
148 This memo uses wire encoding types "byte", "uint32", "uint64",
149 "mpint" and "string" with meanings as described in [RFC4251].
151 This memo defines the following new wire encoding type.
153 "short-str" is a shorter version of "string", encoded as follows:
155 byte n = short-str-len (unsigned, 0..255)
156 byte[n] short-str-value
158 Figure 1
160 2.3. Obfuscated Envelope
162 Since SSH servers are commonly used for remote administration, they
163 are a high-value target for password guessing. One of the most
164 common complaints from SSH server administrators is the high
165 frequency of password guessing connections from random clients.
167 Experience shows that obfuscating the SSH protocol with an
168 obfuscation keyword is a valuable measure which thwarts password
169 guessing. This increases practical security of the SSH ecosystem
170 even if obfuscation does not thwart narrowly targeted attacks.
172 Every SSH/QUIC connection is parameterized by an obfuscation keyword.
173 The obfuscation keyword is a sequence of Unicode characters entered
174 by a user. Applications MUST permit the user to enter any Unicode
175 characters except code points in the Unicode category "Cc" (Control).
176 These are decimal code points 0..31 and 127..159, inclusive.
178 An SSH/QUIC server SHOULD allow the administrator to configure an
179 obfuscation keyword for each interface and port on which the server
180 is accepting SSH/QUIC connections. An SSH/QUIC client MUST allow the
181 user to configure an obfuscation keyword separately for outgoing
182 connections to each server address and port.
184 The obfuscation keyword MUST be optional for users to configure. If
185 a user does not configure it, the obfuscated envelope is applied as
186 if the obfuscation keyword was an empty character sequence.
188 All SSH/QUIC key exchange packets are sent as UDP datagrams in the
189 following obfuscated envelope:
191 byte[16] obfs-nonce - high bit of first byte MUST be set
192 byte[] obfs-payload
193 byte[16] obfs-tag
194 Figure 2
196 The field "obfs-nonce" contains random bytes generated by the sender
197 of the UDP datagram. The high bit of the first byte of "obfs-nonce"
198 MUST be set to distinguish the packet from QUIC datagrams. See
199 Section 2.1.
201 The field "obfs-payload" contains the SSH/QUIC key exchange packet
202 encrypted using AEAD_AES_256_GCM [RFC5116]. The AEAD is invoked as
203 follows:
205 * The secret key K is a SHA-256 digest of the obfuscation keyword in
206 UTF-8 encoding.
208 * The nonce N is the field "obfs-nonce".
210 * The plaintext P is the unencrypted packet payload.
212 * Associated data A is empty.
214 * The ciphertext C is stored in "obfs-payload".
216 The length of encrypted "obfs-payload" is implied by the UDP datagram
217 length, and is calculated by subtracting the fixed lengths of "obfs-
218 nonce" and "obfs-tag".
220 The field "obfs-tag" stores the GCM tag. Receivers MUST check the
221 tag and MUST ignore datagrams where the GCM tag is invalid.
223 2.4. Packet Size Limits
225 Clients and servers MUST accept SSH_QUIC_INIT, SSH_QUIC_REPLY and
226 SSH_QUIC_CANCEL packets with unencrypted "obfs-payload" sizes at
227 least up to 32768 bytes. This corresponds to minimum SSH packet size
228 limits which implementations must support as per [RFC4253],
229 Section 6.1.
231 2.5. Required QUIC Versions and TLS Cipher Suites
233 Clients and servers are REQUIRED to implement QUIC protocol version 1
234 once it is standardized in [QUIC] and [QUIC-TLS].
236 Clients and servers are REQUIRED to implement the TLS cipher suites
237 TLS_AES_128_GCM_SHA256 and TLS_AES_256_GCM_SHA384 [RFC8446]. Other
238 cipher suites are optional.
240 The requirement to implement any particular QUIC protocol version or
241 TLS cipher suite expires on the 5-year anniversary of the publishing
242 of this memo. At that point, implementers SHOULD consult any new
243 standards documents if available, or survey the practical use of SSH/
244 QUIC for implementation guidance.
246 2.6. Random Elements
248 Unlike SSH over TCP, the packets SSH_QUIC_INIT and SSH_QUIC_REPLY do
249 not provide a "cookie" field for random data. Instead, clients and
250 servers MUST insert random data using the extensibility mechanisms
251 described for each SSH key exchange packet.
253 At the very minimum, clients and servers MUST insert at least 16
254 Random Bytes or at least one Random Name, in locations as described
255 for SSH_QUIC_INIT (Section 2.8.1) and SSH_QUIC_REPLY (Section 2.9.2).
256 If at all possible, the random data MUST come from a
257 cryptographically strong random source. Implementations that are
258 unable to meet this requirement MUST still insert the minimum amount
259 of random data, as unpredictably as they are able. Compromising on
260 this requirement reduces the security of any sessions created on the
261 basis of such SSH_QUIC_INIT and SSH_QUIC_REPLY.
263 Lengths of Random Names and Random Bytes SHOULD be chosen at random
264 such that lengths in the shorter end of the range are significantly
265 more probable, but long lengths are still selected. See Appendix A.
267 Random Bytes
269 Random Bytes are generated with values 0..255, in a range of lengths
270 as specified for the particular usage context.
272 Random Name
274 A Random Name is generated in one of two forms: Assigned Form or
275 Private Form. One of the two forms is randomly chosen so that
276 Assigned Form, which is shorter, is more likely. The maximum length
277 of a Random Name is 64 bytes.
279 Assigned Form
281 A Random Name in Assigned Form is generated as a string of random
282 characters with ASCII values 33..126 (inclusive), except @ and the
283 comma (","). Other characters MUST NOT be included. To avoid
284 collisions as effectively as a random UUID, a Random Name in Assigned
285 Form MUST contain at least 20 random characters if using the complete
286 character set. A Random Name in Assigned Form MUST then be of length
287 20..64 bytes.
289 Implementations MAY remove up to 7 characters from the character set
290 -- reducing it to 85..91 characters -- without increasing the minimum
291 length. If the character set is further reduced to 69..84
292 characters, implementations MUST generate at least 21 random
293 characters instead.
295 Example Random Names in Assigned Form:
297 d`kbi>AGrj~r{3lo_Q4r
298 wNT)=/8C<(DB1|tr:>1f[xq>9bG
299 u7^dE'\EE_}N}^"J5syI?/8jIxup#s7BM:]>{IT_p3Z~wJDYIBX.4zzQ$@denisbider.com
313 ?`z4bb/}
&Wuf6O7CE?cA`$j"@bider.us
315 Figure 4
317 Alternately, implementations MAY generate a Random Name in Anonymous
318 Form with the format "(local)@(domain).example.com". In this case,
319 both "(local)" and "(domain)" are replaced by random ASCII characters
320 from the set A..Z, a..z, and 0..9. This is to ensure that the suffix
321 has valid domain name syntax.
323 To avoid collisions as effectively as a random UUID, a Random Name in
324 Anonymous Form MUST contain at least 22 random characters. A Random
325 Name in Anonymous Form MUST then be of length 35..64 bytes.
327 2.7. Errors in Key Exchange
329 To assist users, clients and servers SHOULD report key exchange
330 errors as follows:
332 1. If a server cannot send a successful SSH_QUIC_REPLY, it SHOULD
333 send an Error Reply. See Section 2.9.1.
335 2. If a client receives an invalid SSH_QUIC_REPLY, it SHOULD send an
336 SSH_QUIC_CANCEL. See Section 2.10.
338 Both packet types use the following extension pairs.
340 2.7.1. "disc-reason" Extension Pair
342 "ext-pair-name" contains "disc-reason".
344 "ext-pair-data" encodes a uint32 with the SSH disconnect reason code.
345 Reason codes are defined in the table "Disconnect Messages Reason
346 Codes and Descriptions" in the IANA registry "Secure Shell (SSH)
347 Protocol Parameters" [IANA-SSH].
349 2.7.2. "err-desc" Extension Pair
351 "ext-pair-name" contains "err-desc".
353 "ext-pair-data" encodes a human-readable error description in any
354 language intended to be relevant to the user, encoded as UTF-8.
356 Receivers that process error descriptions MUST validate that the
357 description is valid UTF-8. If a description is long, receivers
358 SHOULD truncate it to a reasonable length depending on the processing
359 context. For example, a debug log file can record a full 32 kB error
360 description, while a production log file SHOULD truncate it to a much
361 shorter length.
363 2.8. SSH_QUIC_INIT
365 A client begins an SSH/QUIC session by sending one or more copies of
366 SSH_QUIC_INIT. If multiple copies are sent, copies intended for the
367 same connection MUST be identical. A reasonable strategy is to send
368 one copy every 50 - 500 ms until the client receives a valid
369 SSH_QUIC_REPLY or times out. A server MUST remember recently
370 received SSH_QUIC_INIT packets and send identical SSH_QUIC_REPLY
371 responses. If different SSH_QUIC_INIT packets are received from the
372 same client IP address, the server MUST assume they are intended to
373 begin separate connections, even if they specify the same "client-
374 connection-id". A server MAY implement throttling of incoming
375 connections, by IP address or otherwise, where excessive
376 SSH_QUIC_INIT packets are disregarded. Once a server receives QUIC
377 data confirming that a client has processed an SSH_QUIC_REPLY, the
378 server MUST disregard any further identical copies of the same
379 SSH_QUIC_INIT, at least until the SSH/QUIC session started by such an
380 SSH_QUIC_INIT ends.
382 SSH_QUIC_INIT is an obfuscated datagram (Section 2.3) where "obfs-
383 payload" encrypts the following:
385 byte SSH_QUIC_INIT = 1 (see Extensibility)
386 short-str client-connection-id (MAY be empty)
387 short-str server-name-indication (MUST NOT be empty)
389 byte v = nr-quic-versions (MUST NOT be zero)
390 uint32[v] client-quic-versions
392 string client-sig-algs (MUST NOT be empty)
394 byte f = nr-trusted-fingerprints (MAY be zero)
395 the following 1 field repeated f times:
396 short-str trusted-fingerprint (MUST NOT be empty)
398 byte k = nr-client-kex-algs (MUST NOT be zero)
399 the following 2 fields repeated k times:
400 short-str client-kex-alg-name (MUST NOT be empty)
401 string client-kex-alg-data (MUST NOT be empty)
403 byte c = nr-cipher-suites (MUST NOT be zero)
404 the following 1 field repeated c times:
405 short-str quic-tls-cipher-suite
407 byte e = nr-ext-pairs (see Extensibility)
408 the following 2 fields repeated e times:
409 short-str ext-pair-name (MUST NOT be empty)
410 string ext-pair-data (MAY be empty)
412 byte[0..] padding: all 0xFF to minimal obfs-payload size 1200
414 Figure 5
416 SSH_QUIC_INIT does not include an SSH version string or compression
417 negotiation. Instead, clients MUST use SSH_MSG_EXT_INFO for these
418 purposes. See Section 4.
420 SSH_QUIC_INIT does not include a "cookie" field for random data.
421 Clients MUST insert random data using the packet's extensibility
422 mechanisms. See Section 2.8.1 and Section 2.6.
424 The field "client-connection-id" contains a QUIC Connection ID of
425 length 0..20 bytes. The server will use this as the QUIC Destination
426 Connection ID in QUIC packets sent to the client. Clients MAY send
427 an empty Connection ID if they are using other means of routing
428 connections.
430 The field "server-name-indication" SHOULD contain the server DNS name
431 if a DNS name was entered by the user when configuring the
432 connection. This can be invaluable in hosting environments: it
433 allows servers to expose to clients multiple distinct identities on
434 the same network address and port. If non-empty, the field MUST
435 encode the DNS name entered by the user as a string consisting of
436 printable US-ASCII characters. Internationalized domain names MUST
437 be represented in their US-ASCII encoding. If the user connected
438 directly to an IP address, this field MUST be empty. This avoids
439 disclosing private information in case of port forwarded connections.
440 Example non-empty values:
442 localhost
443 server.example.com
444 xn--bcher-kva.example
446 Figure 6
448 The fields "client-quic-versions" enumerate QUIC protocol versions
449 supported by the client. The client MUST send at least one version.
450 The client MUST send supported versions in the order it prefers the
451 server to use them.
453 The field "client-sig-algs" MUST contain at least one signature
454 algorithm supported by the client for server authentication. These
455 are the same algorithms as used in SSH_MSG_KEXINIT ([RFC4253],
456 Section 7.1) in the field "server_host_key_algorithms". The client
457 MUST send signature algorithms in the order it prefers the server to
458 use them.
460 The client SHOULD include algorithms in "client-sig-algs" as follows:
462 * If the client does not yet trust any host key for the server:
463 "client-sig-algs" SHOULD include all signature algorithms
464 supported and enabled by the client for use with any server.
466 * Otherwise, the client already trusts some host keys for the
467 server. In this case, if the client sends any "trusted-
468 fingerprint" fields, then "client-sig-algs" SHOULD include all
469 signature algorithms supported and enabled by the client for use
470 with any server.
472 * Otherwise, the client already trusts some host keys for the
473 server, but does not send any "trusted-fingerprint" fields. In
474 this case, "client-sig-algs" MUST include only signature
475 algorithms associated with the host keys the client already trusts
476 for this server.
478 There MAY be zero or more "trusted-fingerprint" fields. Each
479 "trusted-fingerprint" contains a binary fingerprint of a host key
480 that is trusted for this connection by the client. The fingerprint
481 algorithm is left unspecified. The server SHOULD try to match the
482 fingerprint using all algorithms it supports which produce the
483 provided fingerprint size. The current recommended fingerprint
484 algorithm is SHA-256, with fingerprint size 32 bytes. Servers MUST
485 tolerate the presence of unrecognized fingerprints of any size. The
486 preference order of trusted fingerprints is dominated by the
487 preference order of algorithms in "client-sig-algs".
489 The packet MUST include at least one SSH key exchange algorithm,
490 encoded as a pair of "client-kex-alg-name" and "client-kex-alg-data"
491 fields. The field "client-kex-alg-name" MUST specify a key exchange
492 method which would be valid in the field "kex_algorithms" in
493 SSH_MSG_KEXINIT under [RFC4253], Section 7.1. In addition, the key
494 exchange method MUST meet criteria in Section 3.
496 If the client wishes to simply advertise its support for a particular
497 key exchange algorithm, but does not prefer to use it in this
498 connection, it MAY enumerate the algorithm with empty "client-kex-
499 alg-data". Otherwise, if the client wishes to allow the algorithm to
500 be used, it MUST include non-empty "client-kex-alg-data". In this
501 case, "client-kex-alg-data" contains the client's portion of key
502 exchange inputs as specified in Section 3. The client MAY send
503 multiple key exchange algorithms with filled-out "client-kex-alg-
504 data". The client MUST send these algorithms in the order it prefers
505 the server to use them.
507 There MUST be at least one "quic-tls-cipher-suite" field. Each of
508 these specifies a TLS cipher suite ([RFC8446], Appendix B.4) which is
509 supported by the client, and which can be used with a version of QUIC
510 ([QUIC], [QUIC-TLS]) supported by the client. The client MUST
511 enumerate supported cipher suites in the order it prefers the server
512 to use them.
514 The client MAY send any number of extensions, encoded as a pair of
515 "ext-pair-name" and "ext-pair-data" fields. This memo defines no
516 extensions for SSH_QUIC_INIT, but see Section 2.8.1.
518 The "padding" field contains all 0xFF bytes to ensure that the
519 unencrypted "obfs-payload" for SSH_QUIC_INIT is at least 1200 bytes
520 in length. Servers MUST ignore smaller SSH_QUIC_INIT packets. This
521 is REQUIRED to prevent abuse of SSH_QUIC_INIT for Amplified
522 Reflection DDoS. If the unencrypted size of "obfs-payload" is
523 already 1200 bytes or larger, the padding MAY be omitted.
525 2.8.1. Extensibility
527 Implementations MUST allow room for future extensibility of
528 SSH_QUIC_INIT in the following manners:
530 1. By using a different packet type in the first byte -- this is, a
531 value other than 1 used by SSH_QUIC_INIT. Servers MUST NOT
532 penalize clients for sending unknown packet types unless there is
533 another reason to penalize the client, such as a blocked IP
534 address or the sheer volume of datagrams.
536 2. By including algorithms in "client-sig-algs" which are unknown to
537 or not supported by the server. Servers MUST tolerate the
538 presence of such algorithms.
540 3. By including fingerprints in "trusted-fingerprints" that use
541 algorithms or lengths that are unknown to or not supported by the
542 server. Servers MUST tolerate the presence of such fingerprints.
544 4. By including SSH key exchange algorithms which are unknown to or
545 not supported by the server, with algorithm data in a format
546 that's unknown to or not supported by the server. Servers MUST
547 tolerate the presence of such algorithms and their data.
549 5. By including QUIC TLS cipher suites which are unknown to or not
550 supported by the server. Servers MUST tolerate the presence of
551 such cipher suites.
553 6. By including extensions which are unknown to or not supported by
554 the server, with extension data in a format that's unknown to or
555 not supported by the server. Servers MUST tolerate the presence
556 of such extensions and their data.
558 Experience shows that any extensibility which is not actively
559 exercised is lost due to implementations that lock down expectations
560 incorrectly. Therefore, all clients MUST do at least one of the
561 following, in each SSH_QUIC_INIT packet, at random:
563 1. In the field "client-sig-algs", include in a random position at
564 least one Random Name (Section 2.6).
566 2. In the fields "client-quic-versions", include in a random
567 position a version number of the form 0x0A?A?A?A, where ?
568 indicates a random nibble. See [QUIC], section "Versions". Note
569 the difference from the random version pattern in the server's
570 SSH_QUIC_REPLY. Due to the minimal amount of entropy provided by
571 this rule, this MUST NOT be the only insertion of randomness made
572 in a packet.
574 3. Include in a random position at least one host key fingerprint
575 consisting of 16..255 Random Bytes (Section 2.6).
577 4. Include in a random position at least one SSH key exchange
578 algorithm where the field "client-kex-alg-name" contains a Random
579 Name, and the field "client-kex-alg-data" contains 0..1000 Random
580 Bytes.
582 5. In the fields "quic-tls-cipher-suite", include in a random
583 position at least one entry consisting of 16..255 Random Bytes.
585 6. In extension pairs, include in a random position at least one
586 extension where the field "ext-pair-name" contains a Random Name,
587 and the field "ext-pair-value" contains 0..1000 Random Bytes.
589 2.9. SSH_QUIC_REPLY
591 Implementations MUST take care to prevent abuse of the SSH/QUIC key
592 exchange for Amplified Reflection DDoS attacks. This means:
594 1. A server MUST NOT send more than one SSH_QUIC_REPLY in response
595 to any individual SSH_QUIC_INIT.
597 2. A server MUST NOT respond to any SSH_QUIC_INIT with unencrypted
598 "obfs-payload" smaller than 1200 bytes.
600 3. Before sending an SSH_QUIC_REPLY, the server MUST verify that the
601 reply is shorter than the SSH_QUIC_INIT packet to which it is
602 replying. If this is not the case, the server MUST send an Error
603 Reply (Section 2.9.1). Such an Error Reply MUST be shorter than
604 the SSH_QUIC_INIT packet.
606 SSH_QUIC_REPLY is an obfuscated datagram (Section 2.3) where "obfs-
607 payload" encrypts the following:
609 byte SSH_QUIC_REPLY = 2
610 short-str client-connection-id
611 short-str server-connection-id (Non-empty except on error)
613 byte v = nr-quic-versions (MUST NOT be zero)
614 uint32[v] server-quic-versions
616 string server-sig-algs (MUST NOT be empty)
617 string server-kex-algs (MUST NOT be empty)
619 byte c = nr-cipher-suites (MUST NOT be zero)
620 the following 1 field repeated c times:
621 short-str quic-tls-cipher-suite
623 byte e = nr-ext-pairs (see Extensibility)
624 the following 2 fields repeated e times:
625 short-str ext-pair-name (MUST NOT be empty)
626 string ext-pair-data (MAY be empty)
628 string server-kex-alg-data (Non-empty except on error)
630 Figure 7
632 SSH_QUIC_REPLY does not include an SSH version string or compression
633 negotiation. Instead, servers MUST use SSH_MSG_EXT_INFO for these
634 purposes. See Section 4.
636 SSH_QUIC_REPLY does not include a "cookie" field for random data.
637 Servers MUST insert random data using the packet's extensibility
638 mechanisms. See Section 2.9.2 and Section 2.6.
640 The field "client-connection-id" encodes the "client-connection-id"
641 sent by the client in SSH_QUIC_INIT.
643 The field "server-connection-id" contains a QUIC Connection ID of
644 length 1..20 bytes. The client will use this as the QUIC Destination
645 Connection ID in QUIC packets sent to the server. This field MUST be
646 empty if sending an Error Reply (Section 2.9.1), and MUST NOT be
647 empty otherwise.
649 The fields "server-quic-versions" enumerate QUIC protocol versions
650 supported by the server. The server MUST send at least one version.
651 The QUIC version used for the connection is the first version
652 enumerated in "client-quic-versions" which is also present in
653 "server-quic-versions". If there is no such version, see
654 Section 2.9.1.
656 The field "server-sig-algs" MUST contain at least one signature
657 algorithm supported by the server. The server SHOULD enumerate all
658 signature algorithms for which it has host keys. These are the same
659 algorithms as used in SSH_MSG_KEXINIT ([RFC4253], Section 7.1) in the
660 field "server_host_key_algorithms". In the SSH/QUIC key exchange,
661 the server MUST use a host key it possesses that (1) matches any
662 fingerprint enumerated in the "trusted-fingerprint" fields in
663 SSH_QUIC_INIT; and (2) can be used with the earliest possible
664 signature algorithm enumerated in "client-sig-algs". If there are
665 multiple such host keys, the client's preference order in "client-
666 sig-algs" dominates the preference order of "trusted-fingerprint".
667 If there is no such host key, the server MUST use any host key that
668 can be used with the earliest possible signature algorithm enumerated
669 in "client-sig-algs". If there is no such host key either, see
670 Section 2.9.1.
672 The field "server-kex-algs" MUST contain at least one SSH key
673 exchange algorithm supported by the server. The key exchange
674 algorithm which is used in the connection is the first algorithm sent
675 in client's SSH_QUIC_INIT where: (1) the field "client-kex-alg-data"
676 is non-empty, and (2) the algorithm is also present in "server-kex-
677 algs". If there is no such key exchange algorithm, see
678 Section 2.9.1.
680 There MUST be at least one "quic-tls-cipher-suite" field. Each of
681 these specifies a TLS cipher suite ([RFC8446], Appendix B.4) which is
682 supported by the server, and which can be used with a version of QUIC
683 ([QUIC], [QUIC-TLS]) supported by the server. The TLS cipher suite
684 which is used for the connection is the first suite sent in the
685 client's SSH_QUIC_INIT where: (1) the cipher suite is supported by
686 the negotiated QUIC protocol version, and (2) the cipher suite is
687 present in the server's SSH_QUIC_REPLY. If there is no such cipher
688 suite, see Section 2.9.1.
690 The server MAY send any number of extensions, encoded as a pair of
691 "ext-pair-name" and "ext-pair-data" fields. Some extensions are
692 defined for use with an Error Reply (see Section 2.9.1). Other
693 extensions MAY be defined in the future; see Section 2.9.2.
695 The field "server-kex-alg-data" MUST be empty if the packet is an
696 Error Reply. Otherwise, this field contains information for the SSH
697 key exchange method: see Section 3. Generally, this includes the
698 server's portion of key exchange inputs; the server's host key; and
699 the server's signature of the calculated exchange hash.
701 2.9.1. Error Reply
703 If a server encounters an error which it is useful and appropriate to
704 communicate to the client, the server MAY send an "Error Reply"
705 version of SSH_QUIC_REPLY. Such a reply is created as follows:
707 * The server includes and populates all fields of SSH_QUIC_REPLY as
708 it would normally, except that the fields "server-connection-id"
709 and "server-kex-alg-data" MUST remain empty.
711 * In the extension pair fields, a "disc-reason" Extension Pair MUST
712 be included. An "err-desc" Extension Pair MAY also be included.
713 See Section 2.7.
715 * Extensibility considerations for SSH_QUIC_REPLY in Section 2.9.2
716 also apply to an Error Reply.
718 If the server does not support any of the QUIC protocol versions
719 enumerated by the client, the server SHOULD send an Error Reply with
720 the disconnect reason code
721 SSH_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED.
723 In the following circumstances, the server SHOULD send an Error Reply
724 with the disconnect reason code SSH_DISCONNECT_KEY_EXCHANGE_FAILED:
726 * If the server could have sent a successful SSH_QUIC_REPLY, but it
727 would have been larger than the client's SSH_QUIC_INIT, even
728 though the SSH_QUIC_INIT met or exceeded the minimum length.
730 * If the server possesses no server host key that can be used with a
731 signature algorithm enumerated in the client's SSH_QUIC_INIT.
733 * If the server supports no key exchange algorithms matching the
734 ones for which the client sent "client-kex-alg-data" in
735 SSH_QUIC_INIT.
737 * If the server supports no TLS cipher suites enumerated in the
738 client's SSH_QUIC_INIT.
740 Besides "disc-reason", an "err-desc" extension pair SHOULD be
741 included to describe the specific error.
743 2.9.2. Extensibility
745 Implementations MUST allow room for future extensibility of
746 SSH_QUIC_REPLY in the following manners:
748 1. By including algorithms in "server-sig-algs" which are unknown to
749 or not supported by the client. Clients MUST tolerate the
750 presence of such algorithms.
752 2. By including SSH key exchange algorithms which are unknown to or
753 not supported by the client, with algorithm data in a format
754 that's unknown to or not supported by the client. Clients MUST
755 tolerate the presence of such algorithms and their data.
757 3. By including QUIC TLS cipher suites which are unknown to or not
758 supported by the client. Clients MUST tolerate the presence of
759 such cipher suites.
761 4. By including extensions which are unknown to or not supported by
762 the client, with extension data in a format that's unknown to or
763 not supported by the client. Clients MUST tolerate the presence
764 of such extensions and their data.
766 Experience shows that any extensibility which is not actively
767 exercised is lost due to implementations that lock down expectations
768 incorrectly. Therefore, all servers MUST do at least one of the
769 following, in each SSH_QUIC_REPLY packet, at random:
771 1. In the fields "server-quic-versions", include in a random
772 position a version number of the form 0xFA?A?A?A, where ?
773 indicates a random nibble. See [QUIC], section "Versions". Note
774 the difference from the random version pattern in the client's
775 SSH_QUIC_INIT. Due to the minimal amount of entropy provided by
776 this rule, this MUST NOT be the only insertion of randomness made
777 in a packet.
779 2. In the field "server-sig-algs", include in a random position one
780 Random Name (Section 2.6).
782 3. In the field "server-kex-algs", include in a random position one
783 Random Name (Section 2.6).
785 4. In the fields "quic-tls-cipher-suite", include in a random
786 position one entry consisting of 16..64 Random Bytes.
788 5. In extension pairs, include in a random position one extension
789 pair where the field "ext-pair-name" contains a Random Name, and
790 the field "ext-pair-value" contains 0..100 Random Bytes.
792 2.10. SSH_QUIC_CANCEL
794 If a client cannot process the server's successful SSH_QUIC_REPLY,
795 the client SHOULD report the error to the server using
796 SSH_QUIC_CANCEL.
798 A client MUST NOT send an SSH_QUIC_CANCEL in response to an
799 SSH_QUIC_REPLY which is itself an Error Reply. A client MUST assume
800 that such a connection was already canceled by the server.
802 A client SHOULD send two or more copies of SSH_QUIC_CANCEL, in
803 transmissions separated by a fraction of a second, to increase the
804 likelihood of successful delivery. The server sends no
805 acknowledgment to SSH_QUIC_CANCEL. After the server has received
806 SSH_QUIC_CANCEL, it MUST ignore subsequent copies of SSH_QUIC_CANCEL
807 for the same connection.
809 SSH_QUIC_CANCEL is an obfuscated datagram (Section 2.3) where "obfs-
810 payload" encrypts the following:
812 byte SSH_QUIC_CANCEL = 3
813 short-str server-connection-id
815 byte e = nr-ext-pairs (see Extensibility)
816 the following 2 fields repeated e times:
817 short-str ext-pair-name (MUST NOT be empty)
818 string ext-pair-data (MAY be empty)
820 Figure 8
822 The "server-connection-id" field MUST equal the "server-connection-
823 id" field in the server's SSH_QUIC_REPLY.
825 In the extension pair fields, a "disc-reason" Extension Pair MUST be
826 included. An "err-desc" Extension Pair MAY also be included. See
827 Section 2.7.
829 2.10.1. Extensibility
831 Extensibility considerations also apply to SSH_QUIC_CANCEL:
833 * Clients MAY include extensions which are unknown to or not
834 supported by the server, with extension data in a format that's
835 unknown to or not supported by the server.
837 * Servers MUST tolerate the presence of such extensions and their
838 data.
840 * Clients SHOULD include, in a random position, at least one
841 extension pair where the field "ext-pair-name" contains a Random
842 Name, and the field "ext-pair-value" contains 0..300 Random Bytes.
844 3. Key Exchange Methods
846 Clients and servers MAY use any key exchange method which is defined
847 for SSH over TCP, whether it is assigned or private, as long as it
848 meets all of the following criteria:
850 1. The algorithm requires exactly one message from the client to the
851 server, for example SSH_MSG_KEX_ECDH_INIT. We call this message
852 KEXMSG_CLIENT.
854 2. The algorithm requires exactly one reply from the server to the
855 client, for example SSH_MSG_KEX_ECDH_REPLY. We call this message
856 KEXMSG_SERVER.
858 3. The algorithm specifies a hash function HASH, for example SHA-
859 256, SHA-384, or SHA-512.
861 4. The algorithm specifies calculation of an exchange hash H by
862 applying HASH to a concatenation of encoded fields.
864 5. The algorithm uses a server host key to sign H.
866 6. The algorithm includes the server's public host key, and the
867 signature of H, in its KEXMSG_SERVER message to the client.
869 7. The algorithm produces a shared secret K, represented as a signed
870 (positive or negative) multi-precision integer.
872 Any such algorithm is modified for use in SSH over QUIC as follows:
874 1. The field "client-kex-alg-data" in SSH_QUIC_INIT encodes the same
875 fields, in the same order, as KEXMSG_CLIENT, including the
876 leading byte for the SSH packet type.
878 2. The field "server-kex-alg-data" in SSH_QUIC_REPLY encodes the
879 same fields, in the same order, as KEXMSG_SERVER, including the
880 leading byte for the SSH packet type.
882 3. The calculation of H specified by the algorithm is not performed.
883 Instead, H is calculated by applying the hash function HASH to a
884 concatenation of the following:
886 string Unencrypted "obfs-payload" content of SSH_QUIC_INIT
888 string Unencrypted "obfs-payload" content of SSH_QUIC_REPLY,
889 excluding the entire field "server-kex-alg-data"
891 The fields of "server-kex-alg-data", excluding signature field
893 mpint K
895 Figure 9
897 When a field is excluded as above, the entire encoding of the field
898 is omitted: both the encoding of the content and the encoding of the
899 length.
901 The SSH packet type byte is included:
903 * To ensure there are at least two fields in the encoded content.
904 This avoids situations where an outer string (the field "client-
905 kex-alg-data") would contain a single inner string (from
906 KEXMSG_CLIENT). This could confuse implementers to incorrectly
907 encode a single string only.
909 * For future consistency. The packet type byte may be useful for
910 multiple-roundtrip key exchange methods, for example those using
911 GSS-API [RFC4462]. Such key exchange methods are not currently
912 defined for SSH/QUIC, but can be.
914 3.1. Required Key Exchange Methods
916 Clients and servers are REQUIRED to implement the key exchange method
917 "curve25519-sha256" [RFC8731]. All other key exchange methods are
918 optional.
920 Clients and servers MAY permit the user to disable a required key
921 exchange method. However, required methods MUST be enabled by
922 default.
924 The requirement to implement any particular key exchange method
925 expires on the 5-year anniversary of the publishing of this memo. At
926 that point, implementers SHOULD consult any new standards documents
927 if available, or survey the practical use of SSH/QUIC for
928 implementation guidance.
930 3.2. Example 1: "curve25519-sha256"
932 When using the SSH key exchange method "curve25519-sha256", the
933 SSH_QUIC_INIT field "client-kex-alg-data" is derived from
934 SSH_MSG_KEX_ECDH_INIT ([RFC5656], Section 4) and contains the
935 following:
937 byte SSH_MSG_KEX_ECDH_INIT = 30
938 string Q_C, client's ephemeral public key octet string
940 Figure 10
942 The SSH_QUIC_REPLY field "server-kex-alg-data" is derived from
943 SSH_MSG_KEX_ECDH_REPLY and contains the following:
945 byte SSH_MSG_KEX_ECDH_REPLY = 31
946 string K_S, server's public host key
947 string Q_S, server's ephemeral public key octet string
948 string the signature on the exchange hash
950 Figure 11
952 The shared secret K is calculated as in [RFC8731]. Then the exchange
953 hash H is calculated by applying SHA-256 to a concatenation of the
954 following:
956 string Content of SSH_QUIC_INIT
957 string Content of SSH_QUIC_REPLY, except "server-kex-alg-data"
958 byte SSH_MSG_KEX_ECDH_REPLY = 31
959 string K_S, server's public host key
960 string Q_S, server's ephemeral public key octet string
961 mpint K
963 Figure 12
965 3.3. Example 2: "diffie-hellman-group14-sha256"
967 When using the SSH key exchange method "diffie-hellman-
968 group14-sha256" [RFC8268], the SSH_QUIC_INIT field "client-kex-alg-
969 data" is derived from SSH_MSG_KEXDH_INIT ([RFC4253], Section 8) and
970 contains the following:
972 byte SSH_MSG_KEXDH_INIT = 30
973 mpint e
975 Figure 13
977 The SSH_QUIC_REPLY field "server-kex-alg-data" is derived from
978 SSH_MSG_KEXDH_REPLY and contains the following:
980 byte SSH_MSG_KEXDH_REPLY = 31
981 string server public host key and certificates (K_S)
982 mpint f
983 string signature of H
985 Figure 14
987 The shared secret K is calculated as in [RFC4253]. Then the exchange
988 hash H is calculated by applying SHA-256 to a concatenation of the
989 following:
991 string Content of SSH_QUIC_INIT
992 string Content of SSH_QUIC_REPLY, except "server-kex-alg-data"
993 byte SSH_MSG_KEXDH_REPLY = 31
994 string server public host key and certificates (K_S)
995 mpint f
996 mpint K
998 Figure 15
1000 4. SSH_MSG_EXT_INFO and the SSH Version String
1002 A common user complaint to SSH application authors is that SSH over
1003 TCP sends the application version in plain text. The application
1004 version cannot be omitted, otherwise implementations cannot support a
1005 number of behaviors which other software versions implement
1006 incorrectly.
1008 A prominent example is the order of arguments in the SFTP request
1009 SSH_FXP_SYMLINK. To send a request that will have the desired
1010 effects, the client MUST consult the server's version string to know
1011 whether the server uses the standard order of fields, or a reverse
1012 order used by OpenSSH.
1014 SSH over QUIC removes the version string from the SSH key exchange.
1015 Instead, all clients and servers are REQUIRED to send and accept
1016 SSH_MSG_EXT_INFO [RFC8308], and to include the "ssh-version"
1017 extension defined here.
1019 Clients MUST send SSH_MSG_EXT_INFO as the very first SSH packet over
1020 QUIC stream 0. The client MUST include the "ssh-version" extension
1021 in this SSH_MSG_EXT_INFO.
1023 Servers MUST send SSH_MSG_EXT_INFO either:
1025 1. as the very first SSH packet over QUIC stream 0, and/or
1027 2. immediately preceding the server's SSH_MSG_USERAUTH_SUCCESS.
1029 A server MUST include the "ssh-version" extension in at least one of
1030 its SSH_MSG_EXT_INFO. If the server sends SSH_MSG_EXT_INFO at both
1031 opportunities, it MAY omit "ssh-version" at the first opportunity,
1032 but only if it will send it in the second opportunity. The second
1033 SSH_MSG_EXT_INFO sent by the server MAY change a previously sent
1034 "ssh-version" extension value to include more specific detail. For
1035 example, the server MAY send a more accurate server software version
1036 when the client has authenticated. The client MUST use the "ssh-
1037 version" value which was most recently received from the server.
1039 4.1. "ssh-version"
1041 The "ssh-version" extension is encoded in SSH_MSG_EXT_INFO as
1042 follows:
1044 string "ssh-version"
1045 string ssh-version-string
1047 Figure 16
1049 The extension value, "ssh-version-string", contains the same SSH
1050 version string as sent at the start of SSH over TCP ([RFC4253],
1051 Section 4.2), but stripping the prefix "SSH-2.0-". Examples inspired
1052 by version strings used in practice:
1054 GenericSoftware
1055 Product_1.2.00
1056 0.12 Library: Application 1.23p1
1058 Figure 17
1060 4.2. "no-flow-control"
1062 The extension "no-flow-control" has no effect in SSH/QUIC. It SHOULD
1063 NOT be sent in SSH/QUIC and MUST be ignored by both parties.
1065 4.3. "delay-compression"
1067 Semantics of the "delay-compression" extension are modified as per
1068 Section 6.1.1.
1070 5. QUIC Session Setup
1072 When the server has sent its SSH_QUIC_REPLY, and when the client has
1073 received it, they each initialize the QUIC session [QUIC] [QUIC-TLS]
1074 as follows:
1076 * The QUIC protocol version is set to the first version advertised
1077 in the client's SSH_QUIC_INIT which is also present in the
1078 server's SSH_QUIC_REPLY.
1080 * Session state is set as if a TLS handshake had just completed.
1082 * The TLS cipher suite is set to the first TLS cipher suite
1083 advertised in SSH_QUIC_INIT which is also present in
1084 SSH_QUIC_REPLY.
1086 * The QUIC Key Phase bit is set to 0.
1088 * The shared secrets that would have been obtained from the TLS
1089 handshake are instead generated from the SSH key exchange
1090 (Section 5.1).
1092 Clients and servers MUST immediately begin to use QUIC Short Header
1093 Packets. Implementations MUST NOT send QUIC Long Header Packets,
1094 since they could be confused with the SSH/QUIC key exchange.
1096 5.1. Shared Secrets
1098 QUIC-TLS [QUIC-TLS] uses a client secret and a server secret from
1099 which it generates an AEAD key, an IV, and a header protection key
1100 for each sending direction.
1102 An SSH key exchange produces a shared secret K, represented as an SSH
1103 multi-precision integer, and an exchange digest H, represented as
1104 binary data [RFC4253]. An SSH key exchange is parameterized with a
1105 hash function we call HASH. Note that HASH can be a different hash
1106 function, producing a different hash length, than the hash function
1107 used by the negotiated TLS cipher suite.
1109 To compute the initial QUIC client and server secrets, the client and
1110 server encode the following binary data, which we call "secret_data":
1112 mpint K
1113 string H
1115 Figure 18
1117 The client and server secrets are then calculated as follows:
1119 client_secret = HMAC-HASH("ssh/quic client", secret_data)
1120 server_secret = HMAC-HASH("ssh/quic server", secret_data)
1122 Figure 19
1124 The HMAC construct is as specified in [RFC2104], instantiated using
1125 the SSH key exchange hash function, HASH.
1127 QUIC keys and IVs are derived from these secrets using the regular
1128 QUIC-TLS key derivation process [QUIC-TLS]. Keys generated from
1129 these secrets are considered 1-RTT keys.
1131 Clients and servers MUST implement QUIC key updates using the regular
1132 QUIC-TLS key update process [QUIC-TLS], respecting the QUIC-TLS
1133 minimum key update frequencies.
1135 6. Adaptation of SSH to QUIC Streams
1137 6.1. SSH/QUIC Packet Format
1139 Each side serializes its SSH packets for sending over QUIC as
1140 follows:
1142 uint32 n = payload-len, high bit set if compressed
1143 byte[n] payload (compressed or uncompressed)
1145 Figure 20
1147 Since security is provided by QUIC-TLS [QUIC-TLS], MAC and random
1148 padding are omitted at this stage.
1150 The "payload-len" field has its high bit set if the "payload" field
1151 is compressed. See Section 6.1.1.
1153 The "payload" field contains the same packet information as the
1154 "payload" field in the Binary Packet Protocol defined in [RFC4253].
1156 6.1.1. Compression
1158 Compression MAY be negotiated using the "delay-compression" extension
1159 in [RFC8308]. If "delay-compression" was negotiated, then:
1161 * If compression is enabled for the server-to-client direction, the
1162 server MAY compress packets on any stream after it has sent
1163 SSH_MSG_USERAUTH_SUCCESS.
1165 * If compression is enabled for the client-to-server direction, the
1166 client MAY compress packets on any stream after it has received
1167 SSH_MSG_USERAUTH_SUCCESS.
1169 Due to multiple streams in SSH/QUIC, the packet SSH_MSG_NEWCOMPRESS
1170 is not an effective mechanism to signal the start of compression and
1171 MUST NOT be sent. It is replaced by the high bit in "payload-len".
1173 6.2. Use of QUIC Streams
1175 To avoid an unnecessary layer of flow control which has performance
1176 and complexity impacts in SSH over TCP, SSH/QUIC uses QUIC streams
1177 for SSH channels and dispenses with flow control on the level of SSH
1178 channels. This simplifies future SSH/QUIC implementations which
1179 might not implement SSH over TCP.
1181 Conducting SSH channels over QUIC streams requires modifications of
1182 the SSH Connection Protocol [RFC4254]. The following sections
1183 describe these modifications.
1185 6.3. Packet Sequence Numbers
1187 In SSH over TCP, every SSH packet has an implicit sequence number
1188 which is unique for the direction of sending (to server vs. to
1189 client). The packet type SSH_MSG_UNIMPLEMENTED makes reference to
1190 this sequence number.
1192 In SSH/QUIC, sequence numbers are separate for each sending
1193 direction, as well as each QUIC stream. This requires modification
1194 of SSH_MSG_UNIMPLEMENTED. This packet type is changed as follows:
1196 byte SSH_MSG_UNIMPLEMENTED
1197 uint64 QUIC stream ID on which the packet was received
1198 uint32 packet sequence number in stream, first packet = 0
1200 Figure 21
1202 6.4. Channel IDs
1204 SSH over TCP uses 32-bit channel IDs which can be reused in the same
1205 session and do not have to be used sequentially. Conflicts in
1206 channel IDs are avoided by identifying each channel with two separate
1207 channel IDs: one designated by the sender and one by the recipient.
1208 [RFC4254]
1209 QUIC streams use 62-bit channel IDs which cannot be reused and MUST
1210 be used sequentially. Both sides use the same stream ID. Conflicts
1211 in stream IDs are avoided by using the least significant bit to
1212 indicate whether the stream was opened by the client or by the
1213 server. [QUIC]
1215 SSH/QUIC uses QUIC stream IDs. This requires modification of SSH
1216 channel-related packets. See Section 6.8.
1218 6.5. Disconnection
1220 The SSH packet type SSH_MSG_DISCONNECT is replaced by sending the
1221 QUIC frame CONNECTION_CLOSE of type 0x1d. The "Error Code" field in
1222 CONNECTION_CLOSE contains the value that would have been sent in the
1223 "reason code" in SSH_MSG_DISCONNECT. The "Reason Phrase" field in
1224 CONNECTION_CLOSE contains the value that would have been sent in
1225 "description" in SSH_MSG_DISCONNECT. The "language tag" field of
1226 SSH_MSG_DISCONNECT is not sent.
1228 6.6. Prohibited SSH Packets
1230 In SSH/QUIC, the following SSH packet types MUST NOT be sent:
1232 SSH_MSG_DISCONNECT 1
1233 SSH_MSG_NEWCOMPRESS 8
1235 SSH_MSG_KEXINIT 20
1236 SSH_MSG_NEWKEYS 21
1237 key exchange packets 30-49
1239 SSH_MSG_CHANNEL_WINDOW_ADJUST 93
1240 SSH_MSG_CHANNEL_CLOSE 97
1242 Figure 22
1244 If they receive packets of these types, clients and servers MAY
1245 disconnect with SSH_DISCONNECT_PROTOCOL_ERROR (Section 6.5).
1246 Alternately, the receiver MAY send SSH_MSG_UNIMPLEMENTED
1247 (Section 6.3).
1249 6.7. Global SSH Packets
1251 In SSH/QUIC, the following SSH packet types MUST be sent on QUIC
1252 stream 0. With the exception of SSH_MSG_UNIMPLEMENTED (Section 6.3),
1253 these packets use the same encoded formats as in SSH over TCP:
1255 SSH_MSG_IGNORE 2
1256 SSH_MSG_UNIMPLEMENTED 3 (Changed format!)
1257 SSH_MSG_DEBUG 4
1258 SSH_MSG_SERVICE_REQUEST 5
1259 SSH_MSG_SERVICE_ACCEPT 6
1260 SSH_MSG_EXT_INFO 7
1262 SSH_MSG_USERAUTH_REQUEST 50
1263 SSH_MSG_USERAUTH_FAILURE 51
1264 SSH_MSG_USERAUTH_SUCCESS 52
1265 SSH_MSG_USERAUTH_BANNER 53
1266 SSH_MSG_USERAUTH_INFO_REQUEST 60
1267 SSH_MSG_USERAUTH_INFO_RESPONSE 61
1269 SSH_MSG_GLOBAL_REQUEST 80
1270 SSH_MSG_REQUEST_SUCCESS 81
1271 SSH_MSG_REQUEST_FAILURE 82
1273 Figure 23
1275 6.8. SSH Channel Packets
1277 All SSH/QUIC channels MUST be opened as bidirectional QUIC streams.
1278 This means QUIC stream IDs where the least significant bits are 10 or
1279 11 MUST NOT be used in SSH/QUIC. Implementations that receive such
1280 stream IDs MUST disconnect with SSH_DISCONNECT_PROTOCOL_ERROR
1281 (Section 6.5)
1283 A client MUST NOT open a non-zero QUIC stream before the server has
1284 sent SSH_MSG_USERAUTH_SUCCESS. If a client does so, the server MUST
1285 disconnect with SSH_DISCONNECT_PROTOCOL_ERROR.
1287 A server MUST NOT open a non-zero QUIC stream before it has sent
1288 SSH_MSG_USERAUTH_SUCCESS. However, a client MUST be prepared for the
1289 possibility that, due to network delays, a stream opened by the
1290 server can be received by the client before SSH_MSG_USERAUTH_SUCCESS.
1291 Therefore, if the client receives a server-initiated stream before
1292 SSH_MSG_USERAUTH_SUCCESS, it MUST assume that the server has also
1293 sent SSH_MSG_USERAUTH_SUCCESS. If the client then receives packets
1294 on QUIC stream 0 which invalidate this assumption, the client MUST
1295 disconnect with SSH_DISCONNECT_PROTOCOL_ERROR.
1297 The initiator of any non-zero QUIC stream MUST send
1298 SSH_MSG_CHANNEL_OPEN as the first packet. If the receiver refuses
1299 the channel, it replies with SSH_MSG_CHANNEL_OPEN_FAILURE. Both
1300 sides then MUST close the QUIC stream as per Section 6.9. In this
1301 case, even though a QUIC stream was opened, an SSH channel was not.
1302 Therefore, other SSH_MSG_CHANNEL_xxxx packets MUST NOT be sent. This
1303 includes SSH_MSG_CHANNEL_EOF.
1305 If the receiver accepts the channel, it replies with
1306 SSH_MSG_CHANNEL_OPEN_CONFIRMATION. Both sides then send SSH packets
1307 of types SSH_MSG_CHANNEL_xxxx. In SSH/QUIC, these packets have the
1308 following formats:
1310 byte SSH_MSG_CHANNEL_OPEN
1311 string channel type in US-ASCII only
1312 uint32 maximum packet size
1313 .... channel-type-specific data follows
1315 Figure 24
1317 byte SSH_MSG_CHANNEL_OPEN_CONFIRMATION
1318 uint32 maximum packet size
1319 .... channel-type-specific data follows
1321 Figure 25
1323 byte SSH_MSG_CHANNEL_OPEN_FAILURE
1324 uint32 reason code
1325 string description in UTF-8
1326 string language tag
1328 Figure 26
1330 byte SSH_MSG_CHANNEL_DATA
1331 string data
1333 Figure 27
1335 byte SSH_MSG_CHANNEL_EXTENDED_DATA
1336 uint32 data_type_code
1337 string data
1339 Figure 28
1341 byte SSH_MSG_CHANNEL_EOF
1343 Figure 29
1345 byte SSH_MSG_CHANNEL_REQUEST
1346 string request type in US-ASCII characters only
1347 boolean want reply
1348 .... type-specific data follows
1350 Figure 30
1352 byte SSH_MSG_CHANNEL_SUCCESS
1354 Figure 31
1356 byte SSH_MSG_CHANNEL_FAILURE
1358 Figure 32
1360 6.9. Closing a Channel
1362 The SSH packet type SSH_MSG_CHANNEL_CLOSE is replaced by QUIC stream
1363 state transitions [QUIC]. Each side considers a channel closed when
1364 the QUIC stream is both in a terminal sending state, and a terminal
1365 receiving state. This means:
1367 * The QUIC sending stream state has become "Data Recvd" or "Reset
1368 Recvd".
1370 * The QUIC receiving stream state has become "Data Read" or "Reset
1371 Read".
1373 The SSH packet type SSH_MSG_CHANNEL_EOF continues to be used. This
1374 packet often does NOT correspond with the end of the stream in its
1375 direction. As in SSH over TCP, SSH channel requests MAY be sent
1376 after SSH_MSG_CHANNEL_EOF, and MUST be handled gracefully by
1377 receivers. A common example is the request "exit-status", which is
1378 sent by a server to communicate a process exit code to the SSH
1379 client, and is commonly sent after the end of output.
1381 7. Acknowledgements
1383 Paul Ebermann for first review and the encouragement to use QUIC
1384 streams.
1386 Ilari Liusvaara for "server-name-indication" and value 1200 for
1387 SSH_QUIC_INIT padding target.
1389 8. IANA Considerations
1391 This document requests no changes to IANA registries.
1393 9. Security Considerations
1395 Clients and servers MUST insert into SSH_QUIC_INIT and SSH_QUIC_REPLY
1396 at least the minimum amount of cryptographically random data as
1397 specified in the section Random Elements. Compromising on this
1398 requirement reduces the security of any session created on the basis
1399 of such an SSH_QUIC_INIT or SSH_QUIC_REPLY.
1401 10. References
1403 10.1. Normative References
1405 [QUIC] Iyengar, J. and M. Thomson, "QUIC: A UDP-Based Multiplexed
1406 and Secure Transport", 2020, .
1409 [QUIC-TLS] Thomson, M. and S. Turner, "Using TLS to Secure QUIC",
1410 2020,
1411 .
1413 [RFC2104] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed-
1414 Hashing for Message Authentication", RFC 2104,
1415 DOI 10.17487/RFC2104, February 1997,
1416 .
1418 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
1419 Requirement Levels", BCP 14, RFC 2119,
1420 DOI 10.17487/RFC2119, March 1997,
1421 .
1423 [RFC4251] Ylonen, T. and C. Lonvick, Ed., "The Secure Shell (SSH)
1424 Protocol Architecture", RFC 4251, DOI 10.17487/RFC4251,
1425 January 2006, .
1427 [RFC4253] Ylonen, T. and C. Lonvick, Ed., "The Secure Shell (SSH)
1428 Transport Layer Protocol", RFC 4253, DOI 10.17487/RFC4253,
1429 January 2006, .
1431 [RFC5116] McGrew, D., "An Interface and Algorithms for Authenticated
1432 Encryption", RFC 5116, DOI 10.17487/RFC5116, January 2008,
1433 .
1435 [RFC5656] Stebila, D. and J. Green, "Elliptic Curve Algorithm
1436 Integration in the Secure Shell Transport Layer",
1437 RFC 5656, DOI 10.17487/RFC5656, December 2009,
1438 .
1440 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC
1441 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
1442 May 2017, .
1444 [RFC8308] Bider, D., "Extension Negotiation in the Secure Shell
1445 (SSH) Protocol", RFC 8308, DOI 10.17487/RFC8308, March
1446 2018, .
1448 [RFC8446] Rescorla, E., "The Transport Layer Security (TLS) Protocol
1449 Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018,
1450 .
1452 [RFC8731] Adamantiadis, A., Josefsson, S., and M. Baushke, "Secure
1453 Shell (SSH) Key Exchange Method Using Curve25519 and
1454 Curve448", RFC 8731, DOI 10.17487/RFC8731, February 2020,
1455 .
1457 10.2. Informative References
1459 [IANA-SSH] IANA, "Secure Shell (SSH) Protocol Parameters",
1460 .
1462 [RFC4250] Lehtinen, S. and C. Lonvick, Ed., "The Secure Shell (SSH)
1463 Protocol Assigned Numbers", RFC 4250,
1464 DOI 10.17487/RFC4250, January 2006,
1465 .
1467 [RFC4252] Ylonen, T. and C. Lonvick, Ed., "The Secure Shell (SSH)
1468 Authentication Protocol", RFC 4252, DOI 10.17487/RFC4252,
1469 January 2006, .
1471 [RFC4254] Ylonen, T. and C. Lonvick, Ed., "The Secure Shell (SSH)
1472 Connection Protocol", RFC 4254, DOI 10.17487/RFC4254,
1473 January 2006, .
1475 [RFC4462] Hutzelman, J., Salowey, J., Galbraith, J., and V. Welch,
1476 "Generic Security Service Application Program Interface
1477 (GSS-API) Authentication and Key Exchange for the Secure
1478 Shell (SSH) Protocol", RFC 4462, DOI 10.17487/RFC4462, May
1479 2006, .
1481 [RFC8268] Baushke, M., "More Modular Exponentiation (MODP) Diffie-
1482 Hellman (DH) Key Exchange (KEX) Groups for Secure Shell
1483 (SSH)", RFC 8268, DOI 10.17487/RFC8268, December 2017,
1484 .
1486 Appendix A. Generating Random Lengths
1488 The SSH/QUIC extensibility mechanism calls for generating random
1489 lengths such that values in the shorter end of the range are
1490 significantly more probable, but long lengths are still selected.
1491 The following C example shows a simple two-step process to prefer
1492 shorter lengths:
1494 int RandomIntBetweenZeroAnd(int maxValueInclusive);
1496 int RandomLen_PreferShort(int minLen, int maxLen)
1497 {
1498 int const SPAN_THRESHOLD = 7;
1499 int lenSpan = maxLen - minLen;
1501 if (lenSpan <= 0)
1502 return minLen;
1504 if (lenSpan > SPAN_THRESHOLD)
1505 if (0 != RandomIntBetweenZeroAnd(3))
1506 return minLen + RandomIntBetweenZeroAnd(SPAN_THRESHOLD);
1508 return minLen + RandomIntBetweenZeroAnd(lenSpan);
1509 }
1511 Figure 33
1513 Author's Address
1515 denis bider
1516 Bitvise Limited
1517 4105 Lombardy Ct
1518 Colleyville, TX 76034
1519 United States
1521 Email: ietf-draft@denisbider.com