Skip to main content
3

SSH_DISCONNECT_KEY_EXCHANGE_FAILED

DisconnectRFC 4253 §11.1

SSH_DISCONNECT_KEY_EXCHANGE_FAILED (3) is sent when the SSH key exchange (KEX) negotiation fails. Client and server could not agree on a common key exchange algorithm, host key type, encryption cipher, MAC algorithm, or compression method. No compatible algorithm was found in any negotiated category.

Code

3

Category

Disconnect

Standard

RFC 4253 §11.1

Description

SSH key exchange failure occurs during the initial SSH handshake when client and server compare their supported algorithm lists and find no overlap. The SSH_MSG_KEXINIT messages each side sends contain lists of supported algorithms in priority order for: key exchange (e.g., curve25519-sha256), host key types (e.g., ecdsa-sha2-nistp256), encryption ciphers, MAC algorithms, and compression methods.

If any of these lists have no intersection, the connection is terminated with code 3. The most common cause in practice is connecting an old SSH client (e.g., OpenSSH 7.x) to a modern server that has disabled legacy algorithms like diffie-hellman-group1-sha1 or ssh-rsa with SHA-1.

Diagnose with: ssh -vvv user@host which shows the algorithm negotiation in detail, or openssh's -Q flag to list supported algorithms.

Common Causes

  • No common key exchange algorithm (old client with diffie-hellman-group1-sha1 disabled on server)
  • ssh-rsa host key type disabled on server, client only accepts RSA
  • Server running FIPS mode restricting algorithms, client not FIPS-compatible
  • No overlap in cipher or MAC algorithm lists
  • Corporate SSH proxy stripping algorithms from the negotiation list