Internet-Draft | SSH/QUIC | July 2020 |
bider | Expires 8 January 2021 | [Page] |
The Secure Shell protocol (SSH) [RFC4251] is widely used for purposes including secure remote administration, file transfer using SFTP and SCP, and encrypted tunneling of TCP connections. Because it is based on TCP, SSH suffers similar problems as motivate the HTTP protocol to transition its transport to UDP-based QUIC [QUIC]. These include: unauthenticated network intermediaries can trivially disconnect SSH sessions; SSH connections are lost when mobile clients change IP addresses; performance limitations in OS-based TCP stacks; any many round-trips to establish the connection. This memo specifies SSH key exchange over UDP and leverages QUIC to provide a UDP-based transport.¶
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.¶
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.¶
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."¶
This Internet-Draft will expire on 8 January 2021.¶
Copyright (c) 2020 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.¶
THIS DOCUMENT IS AN EARLY VERSION AND IS A WORK IN PROGRESS.¶
NON-LATEST DRAFT VERSIONS MUST BE DISREGARDED.¶
IMPLEMENTATION AT THIS STAGE IS EXPERIMENTAL.¶
CONTACT THE AUTHOR IF YOU INTEND TO IMPLEMENT.¶
This memo specifies SSH key exchange over UDP, and then leverages QUIC to provide a UDP-based transport for SSH. QUIC's use of the TLS handshake is replaced with a 1-RTT SSH/QUIC key exchange. The SSH Authentication Protocol [RFC4252] and the SSH Connection Protocol [RFC4254] are then conducted over UDP stream 0 in the same way as they would be over TCP.¶
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.¶
UDP datagrams which form the SSH/QUIC key exchange are sent between the same client and server IP addresses and ports as QUIC datagrams. It is therefore necessary for clients and servers to distinguish SSH key exchange datagrams from QUIC datagrams.¶
A distinction is allowed by that SSH/QUIC only requires the sending of QUIC Short Header Packets. Therefore, all UDP datagrams where the first byte has its high bit set can be handled as part of an SSH/QUIC key exchange.¶
This memo uses wire encoding types "byte", "uint32", "mpint" and "string" with meanings as described in [RFC4251].¶
This memo defines a new wire encoding type "short-str", encoded as follows:¶
Clients and servers MUST accept SSH_QUIC_INIT, SSH_QUIC_REPLY and SSH_QUIC_CANCEL packets of sizes at least up to 32768 bytes. This corresponds to minimum SSH packet limits which implementations must support as per [RFC4253], Section 6.1.¶
Clients and servers are REQUIRED to implement the TLS cipher suites TLS_AES_128_GCM_SHA256 and TLS_AES_256_GCM_SHA384 [RFC8446]. Other cipher suites are optional.¶
Clients and servers MAY permit the user to disable a required cipher suite. However, required suites MUST be enabled by default.¶
Unlike SSH over TCP, the packets SSH_QUIC_INIT and SSH_QUIC_REPLY do not provide a "cookie" field for random data. Instead, clients and servers MUST insert random data using the Extensibility mechanisms.¶
At the very minimum, clients and servers MUST insert at least 16 Random Bytes or at least one Random Name, as described in Section 2.7.1 and Section 2.8.2. If at all possible, the random data MUST come from a cryptographically strong random source. Implementations that are unable to meet this requirement MUST still insert the minimum amount of random data, as unpredictably as they are able. Compromising on this requirement reduces the security of any sessions created on the basis of such SSH_QUIC_INIT and SSH_QUIC_REPLY.¶
Lengths of Random Names and Random Bytes SHOULD be chosen at random such that lengths in the shorter end of the range are significantly more probable, but long lengths are still selected. See Appendix A.¶
Random Bytes are generated with values 0..255, in a range of lengths as specified for the particular usage context.¶
A Random Name is generated in one of two forms: Assigned Form or Private Form. One of the two forms is randomly chosen so that Assigned Form, which is shorter, is more likely. The maximum length of a Random Name is 64 bytes.¶
A Random Name in Assigned Form is generated as a string of random characters with ASCII values 33..126 (inclusive), except @ and the comma (","). Other characters MUST NOT be included. To avoid collisions as effectively as a random UUID, a Random Name in Assigned Form MUST contain at least 20 random characters if the complete character set is used. A Random Name in Assigned Form MUST then be of length 20..64 bytes.¶
Implementations MAY remove up to 7 characters from the character set -- reducing it to 85..91 characters -- without increasing the minimum length. If the character set is further reduced to 69..84 characters, implementations MUST generate at least 21 random characters instead.¶
Example Random Names in Assigned Form:¶
Implementations MAY generate a Random Name in Private Form by first generating a Random Name in Assigned Form, then appending a domain name suffix which the implementer controls. A Random Name generated this way MUST NOT exceed 64 bytes. Example Random Names in Private Form:¶
Alternately, implementations MAY generate a Random Name in Anonymous Form with the format "(local)@(domain).example.com". In this case, both "(local)" and "(domain)" are replaced by random ASCII characters from the set A..Z, a..z, and 0..9. This is to ensure that the suffix has valid domain name syntax.¶
To avoid collisions as effectively as a random UUID, a Random Name in Anonymous Form MUST contain at least 22 random characters. A Random Name in Anonymous Form MUST then be of length 35..64 bytes.¶
To assist users, clients and servers SHOULD report key exchange errors as follows:¶
Both packet types use the following extension pairs.¶
"ext-pair-name" contains "disc-reason".¶
"ext-pair-data" encodes a uint32 with the SSH disconnect reason code. Reason codes are defined in the table "Disconnect Messages Reason Codes and Descriptions" in the IANA registry "Secure Shell (SSH) Protocol Parameters" [IANA-SSH].¶
"ext-pair-name" contains "err-desc".¶
"ext-pair-data" encodes a human-readable error description in any language intended to be relevant to the user, encoded as UTF-8.¶
Receivers that process error descriptions MUST validate that the description is valid UTF-8. If a description is long, receivers SHOULD truncate it to a reasonable length depending on the processing context. For example, a debug log file can record a full 32 kB error description, while a production log file SHOULD truncate it to a much shorter length.¶
A client begins an SSH/QUIC session by sending one or more copies of SSH_QUIC_INIT. If multiple copies are sent, copies intended for the same connection MUST be identical. A reasonable strategy is to send one copy every 50 - 500 ms until the client receives a valid SSH_QUIC_REPLY or times out. A server MUST remember recently received SSH_QUIC_INIT packets and send identical SSH_QUIC_REPLY responses. If different SSH_QUIC_INIT packets are received from the same client IP address, the server MUST assume they are intended to begin separate connections, even if they specify the same "client-connection-id". A server MAY implement throttling of incoming connections, by IP address or otherwise, where excessive SSH_QUIC_INIT packets are disregarded. Once a server receives QUIC data confirming that a client has processed an SSH_QUIC_REPLY, the server MUST disregard any further identical copies of the same SSH_QUIC_INIT, at least until the SSH/QUIC session started by such an SSH_QUIC_INIT ends.¶
The SSH_QUIC_INIT packet is a UDP datagram with the following layout:¶
SSH_QUIC_INIT does not include an SSH version string. Instead, clients MUST use SSH_MSG_EXT_INFO for this purpose. See Section 4.¶
SSH_QUIC_INIT does not include a "cookie" field for random data. Clients MUST insert random data using Extensibility mechanisms. See Section 2.7.1 and Section 2.5.¶
The field "client-connection-id" contains a QUIC Connection ID of length 0..20 bytes. The server will use this as the QUIC Destination Connection ID in QUIC packets sent to the client. Clients are not required to use a Connection ID if they are using other means of routing connections.¶
The fields "client-quic-versions" enumerate QUIC protocol versions supported by the client. The client MUST send at least one version. The client MUST send supported versions in the order it prefers the server to use them.¶
The field "client-sig-algs" MUST contain at least one signature algorithm supported by the client for server authentication. These are the same algorithms as used in SSH_MSG_KEXINIT ([RFC4253], Section 7.1) in the field "server_host_key_algorithms". The client MUST send signature algorithms in the order it prefers the server to use them.¶
There MAY be zero or more "trusted-fingerprint" fields. Each "trusted-fingerprint" contains a binary fingerprint of a host key that is trusted for this connection by the client. The fingerprint algorithm is left unspecified. The server SHOULD try to match the fingerprint using all algorithms it supports which produce the provided fingerprint size. The current recommended fingerprint algorithm is SHA-256, with fingerprint size 32 bytes. Servers MUST tolerate the presence of unrecognized fingerprints of any size. The client MUST send trusted host key fingerprints in the order it prefers the server to use them.¶
The packet MUST include at least one SSH key exchange algorithm, encoded as a pair of "client-kex-alg-name" and "client-kex-alg-data" fields. The field "client-kex-alg-name" MUST specify a key exchange method which would be valid in the field "kex_algorithms" in SSH_MSG_KEXINIT under [RFC4253], Section 7.1. In addition, the key exchange method MUST meet criteria in Section 3.¶
If the client wishes to simply advertise its support for a particular key exchange algorithm, but does not prefer to use it in this connection, it MAY enumerate the algorithm with empty "client-kex-alg-data". Otherwise, if the client wishes to allow the algorithm to be used, it MUST include non-empty "client-kex-alg-data". In this case, "client-kex-alg-data" contains the client's portion of key exchange inputs as specified in Section 3. The client MAY send multiple key exchange algorithms with filled-out "client-kex-alg-data". The client MUST send these algorithms in the order it prefers the server to use them.¶
There MUST be at least one "quic-tls-cipher-suite" field. Each of these specifies a TLS cipher suite ([RFC8446], Appendix B.4) which is supported by the client, and which can be used with a version of QUIC ([QUIC], [QUIC-TLS]) supported by the client. The client MUST enumerate supported cipher suites in the order it prefers the server to use them.¶
The client MAY send any number of extensions, encoded as a pair of "ext-pair-name" and "ext-pair-data" fields. This memo defines no extensions, but see Section 2.7.1.¶
The "padding" field contains all 0xFF bytes to ensure SSH_QUIC_INIT is at least 1400 bytes in length. Servers MUST ignore SSH_QUIC_INIT packets with a UDP datagram size less than 1400 bytes. This is REQUIRED to prevent abuse of SSH_QUIC_INIT for Amplified Reflection DDoS. If the size of SSH_QUIC_INIT is already 1400 bytes or larger, the padding MAY be omitted.¶
Implementations MUST allow room for future extensibility of SSH_QUIC_INIT in the following manners:¶
Experience shows that any extensibility which is not actively exercised is lost due to implementations that lock down expectations incorrectly. Therefore, all clients MUST do at least one of the following, in each SSH_QUIC_INIT packet, at random:¶
Implementations MUST take care to prevent abuse of the SSH/QUIC key exchange for Amplified Reflection DDoS attacks. This means:¶
The SSH_QUIC_REPLY packet is a UDP datagram with the following layout:¶
SSH_QUIC_REPLY does not include an SSH version string. Instead, servers MUST use SSH_MSG_EXT_INFO for this purpose. See Section 4.¶
SSH_QUIC_REPLY does not include a "cookie" field for random data. Servers MUST insert random data using Extensibility mechanisms. See Section 2.8.2 and Section 2.5.¶
The field "server-connection-id" contains a QUIC Connection ID of length 0..20 bytes. The client will use this as the QUIC Destination Connection ID in QUIC packets sent to the server.¶
The fields "server-quic-versions" enumerate QUIC protocol versions supported by the server. The server MUST send at least one version. The QUIC version used for the connection is the first version enumerated in "client-quic-versions" which is also present in "server-quic-versions". If there is no such version, see Section 2.8.1.¶
The field "server-sig-algs" MUST contain at least one signature algorithm supported by the server. These are the same algorithms as used in SSH_MSG_KEXINIT ([RFC4253], Section 7.1) in the field "server_host_key_algorithms". The server MUST use a host key it possesses that (1) matches any fingerprint enumerated in the "trusted-fingerprint" fields in SSH_QUIC_INIT, regardless of fingerprint position; and (2) can be used with the earliest possible signature algorithm enumerated in "client-sig-algs". If there is no such host key, the server MUST use any host key that can be used with the earliest possible signature algorithm enumerated in "client-sig-algs". If there is no such host key either, see Section 2.8.1.¶
...¶
...¶
...¶
...¶
...¶
...¶
...¶
The server MAY send any number of extensions, encoded as a pair of "ext-pair-name" and "ext-pair-data" fields. This memo defines no extensions, but see Section 2.8.2.¶
If a server encounters an error which is appropriate to communicate to the client, the server MAY send an "Error Reply" version of SSH_QUIC_REPLY. Such a reply is created as follows:¶
If the server does not support any of the QUIC protocol versions enumerated by the client, the server SHOULD send an Error Reply with the disconnect reason code SSH_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED.¶
In the following circumstances, the server SHOULD send an Error Reply with the disconnect reason code SSH_DISCONNECT_KEY_EXCHANGE_FAILED:¶
Besides "disc-reason", an "err-desc" extension pair SHOULD be included to describe the specific error.¶
Implementations MUST allow room for future extensibility of SSH_QUIC_REPLY in the following manners:¶
Experience shows that any extensibility which is not actively exercised is lost due to implementations that lock down expectations incorrectly. Therefore, all servers MUST do at least one of the following, in each SSH_QUIC_REPLY packet, at random:¶
If a client cannot process the server's successful SSH_QUIC_REPLY, the client SHOULD report the error to the server using SSH_QUIC_CANCEL.¶
A client MUST NOT send an SSH_QUIC_CANCEL in response to an SSH_QUIC_REPLY which is itself an Error Reply. A client MUST assume that such a connection was already canceled by the server.¶
The SSH_QUIC_CANCEL packet is a UDP datagram with the following layout:¶
The "server-connection-id" field MUST equal the "server-connection-id" field in the server's SSH_QUIC_REPLY.¶
In the extension pair fields, a "disc-reason" Extension Pair MUST be included. An "err-desc" Extension Pair MAY also be included. See Section 2.6.¶
Extensibility considerations also apply to SSH_QUIC_CANCEL:¶
Clients and servers MAY use any key exchange method which is defined for SSH over TCP, whether it is assigned or private, as long as it meets all of the following criteria:¶
Any such algorithm is modified for use in SSH over QUIC as follows:¶
When a field is excluded as above, the entire encoding of the field is omitted: both the encoding of the content and the encoding of the length.¶
When SSH packet type bytes are replaced with 0xFA and 0xFB instead of being removed, this is to ensure that at least two fields remain in the encoded content. If this were not the case, there would be situations where an outer string (the field "client-kex-alg-data") contains a single inner string (from KEXMSG_CLIENT). This is prone to confusion by implementers who could then incorrectly encode a single string only.¶
Clients and servers are REQUIRED to implement the key exchange method "curve25519-sha256" [RFC8731]. All other key exchange methods are optional.¶
Clients and servers MAY permit the user to disable a required key exchange method. However, required methods MUST be enabled by default.¶
As an example, when using the SSH key exchange method "curve25519-sha256", the SSH_QUIC_INIT field "client-kex-alg-data" is derived from SSH_MSG_KEX_ECDH_INIT ([RFC5656], Section 4) and contains the following:¶
The SSH_QUIC_REPLY field "server-kex-alg-data" is derived from SSH_MSG_KEX_ECDH_REPLY and contains the following:¶
The shared secret K is calculated as in [RFC8731]. Then the exchange hash H is calculated by applying SHA-256 to a concatenation of the following:¶
This allows the server to generate the signature and include it in the "server-kex-alg-data" field sent to the client.¶
A common user complaint to SSH application authors is that SSH over TCP sends the application version in plain text. The application version cannot be omitted, otherwise implementations cannot support a number of behaviors which other software versions implement incorrectly.¶
A prominent example is the order of arguments in the SFTP request SSH_FXP_SYMLINK. To send a request that will have the expected effect, the client MUST consult the server's version string to know whether the server uses the standard order of fields, or a reverse order used by OpenSSH.¶
SSH over QUIC removes the version string from the SSH key exchange. Instead, all clients and servers are REQUIRED to send and accept SSH_MSG_EXT_INFO [RFC8308], and to include the "ssh-version" extension (below).¶
Clients MUST send SSH_MSG_EXT_INFO as the very first SSH packet over QUIC. The client MUST include the "ssh-version" extension in this SSH_MSG_EXT_INFO.¶
Servers MUST send SSH_MSG_EXT_INFO either:¶
A server MUST include the "ssh-version" extension in at least one of its SSH_MSG_EXT_INFO. If the server sends SSH_MSG_EXT_INFO at both opportunities, it MAY omit "ssh-version" at the first opportunity, but only if it will send it in the second opportunity. The second SSH_MSG_EXT_INFO sent by the server MAY change a previously sent "ssh-version" extension value to include more specific detail. For example, the server MAY include a more accurate server version. The client MUST use the "ssh-version" value which was most recently received from the server.¶
The "ssh-version" extension is encoded in SSH_MSG_EXT_INFO as follows:¶
The extension value, "ssh-version-string", contains the same SSH version string as sent at the start of SSH over TCP ([RFC4253], Section 4.2). Examples:¶
When the server has sent its SSH_QUIC_REPLY, and when the client has received it, they each initialize the QUIC session [QUIC] [QUIC-TLS] as follows:¶
Clients and servers MUST immediately begin to use QUIC Short Header Packets. Implementations MUST NOT send QUIC Long Header Packets, since they could be confused with the SSH/QUIC key exchange.¶
All SSH/QUIC packets are sent on QUIC stream 0. No other QUIC streams are used in SSH over QUIC.¶
Each side serializes its SSH packets for sending over QUIC as follows:¶
Since security is provided by QUIC-TLS [QUIC-TLS], MAC and random padding are omitted at this stage.¶
In SSH/QUIC, compression algorithms negotiated in the initial SSH key exchange are ignored. Such compression does NOT take effect.¶
Compression MAY be negotiated using the "delay-compression" extension in [RFC8308]. If "delay-compression" is negotiated, and conditions to enable compression are met, then the "payload" field is compressed.¶
Otherwise, the "payload" field contains the same packet information as the "payload" field in the Binary Packet Protocol defined in [RFC4253].¶
This document requests no changes to IANA registries.¶
Clients and servers MUST insert into SSH_QUIC_INIT and SSH_QUIC_REPLY at least the minimum amount of cryptographically random data as specified in the section Random Elements. Compromising on this requirement reduces the security of any session created on the basis of such an SSH_QUIC_INIT or SSH_QUIC_REPLY.¶
The SSH/QUIC extensibility mechanism calls for generating random lengths such that values in the shorter end of the range are significantly more probable, but long lengths are still selected. The following C example shows a simple two-step process to prefer shorter lengths:¶