This document adopts the style and conventions of [
RFC 4253] in specifying how the use of data key exchange is indicated in SSH.
This RFC also collects key exchange method names in various existing RFCs ([
RFC 4253], [
RFC 4419], [
RFC 4432], [
RFC 4462], [
RFC 5656], [
RFC 8268], [
RFC 8308], [
RFC 8731], and [
RFC 8732]) and provides a suggested suitability for implementation of
MUST,
SHOULD,
MAY,
SHOULD NOT, and
MUST NOT. Any method not explicitly listed
MAY be implemented.
Section 7.2 of
RFC 4253 defines the generation of a shared secret K (really the output of the KDF) and an exchange key hash H. Each key exchange method uses a specified HASH function, which must be the same for both key exchange and Key Derivation. H is used for key exchange integrity across the SSH session as it is computed only once. It is noted at the end of
Section 7.2 of
RFC 4253 that:
This process will lose entropy if the amount of entropy in K is larger than the internal state size of HASH.
So, care must be taken that the hashing algorithm used is well chosen ("reasonable") for the key exchange algorithms being used.
This document provides guidance as to what key exchange algorithms are to be considered for new or updated SSH implementations.
In general, key exchange methods that are considered "weak" are being moved to either deprecated ("
SHOULD NOT") or disallowed ("
MUST NOT"). Methods that are newer or considered to be stronger usually require more device resources than many administrators and/or developers need are to be allowed ("
MAY"). (Eventually, some of these methods could be moved by consensus to "
SHOULD" to increase interoperability and security.) Methods that are not "weak" and have implementation consensus are encouraged ("
SHOULD"). There needs to be at least one consensus method promoted to a status of mandatory to implement (MTI). This should help to provide continued interoperability even with the loss of one of the now disallowed MTI methods.
For this document, 112 bits of security strength is the minimum. Use of either or both of SHA-1 and RSA 1024 bits at an approximate 80 bits of security fall below this minimum and should be deprecated and moved to disallowed as quickly as possible in configured deployments of SSH. It seems plausible that this minimum may be increased over time, so authors and administrators may wish to prepare for a switch to algorithms that provide more security strength.
The Elliptic Curve (EC) key exchange algorithms used with SSH include the ECDH and EC Menezes-Qu-Vanstone (ECMQV).
The ECC curves defined for the key exchange algorithms above include the following: curve25519, curve448, the NIST prime curves (nistp256, nistp384, and nistp521), as well as other curves allowed for by
Section 6 of
RFC 5656. There are key exchange mechanisms based on the Generic Security Service Application Program Interface (GSS-API) that use these curves as well that have a "gss-" prefix.
Curve25519 is efficient on a wide range of architectures with properties that allow higher-performance implementations compared to the patented elliptic curve parameters purchased by NIST for the general public to use as described in [
RFC 5656]. The corresponding key exchange methods use SHA2-256 (also known as SHA-256) defined in [
RFC 6234]. SHA2-256 is a reasonable hash for use in both the KDF and session integrity. It is reasonable for both gss and non-gss uses of curve25519 key exchange methods. These key exchange methods are described in [
RFC 8731] and [
RFC 8732] and are similar to the IKEv2 key agreement described in [
RFC 8031]. The curve25519-sha256 key exchange method has multiple implementations and
SHOULD be implemented. The gss-curve25519-sha256-* key exchange method
SHOULD also be implemented because it shares the same performance and security characteristics as curve25519-sha256.
Table 6 contains a summary of the recommendations for curve25519-based key exchanges.
Key Exchange Method Name |
Guidance |
curve25519-sha256 |
SHOULD
|
gss-curve25519-sha256-* |
SHOULD
|
Table 6: Curve25519 Implementation Guidance
Curve448 provides more security strength than curve25519 at a higher computational and bandwidth cost. The corresponding key exchange methods use SHA2-512 (also known as SHA-512) defined in [
RFC 6234]. SHA2-512 is a reasonable hash for use in both the KDF and session integrity. It is reasonable for both gss and non-gss uses of curve448 key exchange methods. These key exchange methods are described in [
RFC 8731] and [
RFC 8732] and are similar to the IKEv2 key agreement described in [
RFC 8031]. The curve448-sha512 key exchange method
MAY be implemented. The gss-curve448-sha512-* key exchange method
MAY also be implemented because it shares the same performance and security characteristics as curve448-sha512.
Table 7 contains a summary of the recommendations for curve448-based key exchanges.
Key Exchange Method Name |
Guidance |
curve448-sha512 |
MAY
|
gss-curve448-sha512-* |
MAY
|
Table 7: Curve448 Implementation Guidance
The ecdh-sha2-* namespace allows for both the named NIST prime curves (nistp256, nistp384, and nistp521) as well as other curves to be defined for the ECDH key exchange. At the time of this writing, there are three named curves in this namespace that
SHOULD be supported. They appear in
Section 10.1 of
RFC 5656. If implemented, the named curves
SHOULD always be enabled unless specifically disabled by local security policy. In
Section 6.1 of
RFC 5656, the method to name other ECDH curves using OIDs is specified. These other curves
MAY be implemented.
The GSS-API namespace with gss-nistp*-sha* mirrors the algorithms used by ecdh-sha2-* names. They are described in [
RFC 8732].
ECDH reduces bandwidth of key exchanges compared to FFC DH at a similar security strength.
Table 8 lists algorithms as "
SHOULD" where implementations may be more efficient or widely deployed. The items listed as "
MAY" in
Table 8 are potentially less efficient.
Key Exchange Method Name |
Guidance |
ecdh-sha2-* |
MAY
|
ecdh-sha2-nistp256 |
SHOULD
|
gss-nistp256-sha256-* |
SHOULD
|
ecdh-sha2-nistp384 |
SHOULD
|
gss-nistp384-sha384-* |
SHOULD
|
ecdh-sha2-nistp521 |
SHOULD
|
gss-nistp521-sha512-* |
SHOULD
|
ecmqv-sha2 |
MAY
|
Table 8: ECDH Implementation Guidance
It is advisable to match the Elliptic Curve Digital Signature Algorithm (ECDSA) and ECDH algorithm to use the same curve for both to maintain the same security strength in the connection.
[
RFC 4419] defines two key exchange methods that use a random selection from a set of pre-generated moduli for key exchange: the diffie-hellman-group-exchange-sha1 method and the diffie-hellman-group-exchange-sha256 method. Per [
RFC 8270], implementations
SHOULD use a MODP group whose modulus size is equal to or greater than 2048 bits. MODP groups with a modulus size less than 2048 bits are weak and
MUST NOT be used.
The diffie-hellman-group-exchange-sha1 key exchange method
SHOULD NOT be used. This method uses SHA-1, which is being deprecated.
The diffie-hellman-group-exchange-sha256 key exchange method
MAY be used. This method uses SHA2-256, which is reasonable for MODP groups less than 4096 bits.
Care should be taken in the pre-generation of the moduli P and generator G such that the generator provides a Q-ordered subgroup of P. Otherwise, the parameter set may leak one bit of the shared secret.
Table 9 provides a summary of the guidance for these exchanges.
Key Exchange Method Name |
Guidance |
diffie-hellman-group-exchange-sha1 |
SHOULD NOT
|
diffie-hellman-group-exchange-sha256 |
MAY
|
Table 9: FFC Generated MODP Group Implementation Guidance
The diffie-hellman-group14-sha256 key exchange method is defined in [
RFC 8268] and represents a key exchange that has approximately 112 bits of security strength that matches 3des-cbc symmetric cipher security strength. It is a reasonably simple transition from SHA-1 to SHA-2, and given that diffie-hellman-group14-sha1 and diffie-hellman-group14-sha256 share a MODP group and only differ in the hash function used for the KDF and integrity, it is a correspondingly simple transition from implementing diffie-hellman-group14-sha1 to implementing diffie-hellman-group14-sha256. Given that diffie-hellman-group14-sha1 is being removed from mandatory to implement (MTI) status, the diffie-hellman-group14-sha256 method
MUST be implemented. The rest of the FFC MODP group from [
RFC 8268] have a larger number of security bits and are suitable for symmetric ciphers that also have a similar number of security bits.
Table 10 provides explicit guidance by name.
Key Exchange Method Name |
Guidance |
diffie-hellman-group14-sha256 |
MUST
|
gss-group14-sha256-* |
SHOULD
|
diffie-hellman-group15-sha512 |
MAY
|
gss-group15-sha512-* |
MAY
|
diffie-hellman-group16-sha512 |
SHOULD
|
gss-group16-sha512-* |
MAY
|
diffie-hellman-group17-sha512 |
MAY
|
gss-group17-sha512-* |
MAY
|
diffie-hellman-group18-sha512 |
MAY
|
gss-group18-sha512-* |
MAY
|
Table 10: FFC Named Group Implementation Guidance
The rsa1024-sha1 key exchange method is defined in [
RFC 4432] and uses an RSA 1024-bit modulus with a SHA-1 hash. This key exchange does NOT meet security requirements. This method
MUST NOT be implemented.
The rsa2048-sha256 key exchange method is defined in [
RFC 4432] and uses an RSA 2048-bit modulus with a SHA2-256 hash. This key exchange meets 112-bit minimum security strength. This method
MAY be implemented.
Table 11 provides a summary of the guidance for IFC key exchanges.
Key Exchange Method Name |
Guidance |
rsa1024-sha1 |
MUST NOT
|
rsa2048-sha256 |
MAY
|
Table 11: IFC Implementation Guidance
The SHA-1 and SHA-2 family of hashing algorithms are combined with the FFC, ECC, and IFC algorithms to comprise a key exchange method name.
The selected hash algorithm is used both in the KDF as well as for the integrity of the response.
All of the key exchange methods using the SHA-1 hashing algorithm should be deprecated and phased out due to security concerns for SHA-1, as documented in [
RFC 6194].
Unconditionally deprecating and/or disallowing SHA-1 everywhere will hasten the day when it may be simply removed from implementations completely. Leaving partially broken algorithms lying around is not a good thing to do.
The SHA-2 family of hashes [
RFC 6234] is more secure than SHA-1. They have been standardized for use in SSH with many of the currently defined key exchanges.
Please note that at the present time, there is no key exchange method for Secure Shell that uses the SHA-3 family of secure hashing functions or the Extendable-Output Functions [
NIST.FIPS.202].
Prior to the changes made by this document, diffie-hellman-group1-sha1 and diffie-hellman-group14-sha1 were MTI. diffie-hellman-group14-sha1 is the stronger of the two. Group14 (a 2048-bit MODP group) is defined in
Section 3 of
RFC 3526. The SSH group1 is defined in
Section 8.1 of
RFC 4253 as using the Oakley Group 2 provided in
Section 6.2 of
RFC 2409 (a 1024-bit MODP group). This group1 MODP group with approximately 80 bits of security is too weak to be retained. However, rather than jumping from the MTI status to making it disallowed, many implementers suggested that it should transition to deprecated first and be disallowed at a later time. The group14 MODP group using a SHA-1 hash for the KDF is not as weak as the group1 MODP group. There are some legacy situations where it will still provide administrators with value, such as small hardware Internet of Things (IOT) devices that have insufficient compute and memory resources to use larger MODP groups before a timeout of the session occurs. There was consensus to transition from MTI to a requirement status that provides for continued use with the expectation that it would be deprecated or disallowed in the future. Therefore, it is considered reasonable to retain the diffie-hellman-group14-sha1 exchange for interoperability with legacy implementations. The diffie-hellman-group14-sha1 key exchange
MAY be implemented, but should be put at the end of the list of negotiated key exchanges.
The diffie-hellman-group1-sha1 and diffie-hellman-group-exchange-sha1
SHOULD NOT be implemented. The gss-group1-sha1-*, gss-group14-sha1-*, and gss-gex-sha1-* key exchanges are already specified as
SHOULD NOT be implemented by [
RFC 8732].
There are two methods, ext-info-c and ext-info-s, defined in [
RFC 8308]. They provide a mechanism to support other Secure Shell negotiations. Being able to extend functionality is desirable. Both ext-info-c and ext-info-s
SHOULD be implemented.