Strovent SystemsSign in
Reference

SSH "connection is not using a post-quantum key exchange algorithm"

OpenSSH 10.1 and later print this when the server offers no post-quantum key exchange. The login still works. Upgrade the server or silence it per host.

This warning comes from the OpenSSH client, version 10.1 or later, right after the key exchange and before you log in:

** WARNING: connection is not using a post-quantum key exchange algorithm.
** This session may be vulnerable to "store now, decrypt later" attacks.
** The server may need to be upgraded. See https://openssh.com/pq.html

It is a warning, not an error. The connection goes on and is encrypted as before. It means the key exchange that was agreed with this server is not one of the post-quantum ones, so someone who records the traffic today might decrypt it later if large quantum computers become real. That risk is what "store now, decrypt later" refers to.

Why you see it

The client and server agree on one key exchange algorithm from the lists both of them offer. OpenSSH counts these as post-quantum:

  • mlkem768x25519-sha256: added in OpenSSH 9.9, the default since 10.0.
  • sntrup761x25519-sha512, also written [email protected]: the default since OpenSSH 9.0.

Both are hybrids: they pair a post-quantum method with X25519, the classic exchange used before, so they are no weaker than what they replace. If the server supports neither, the agreed algorithm is a classic one such as curve25519-sha256 or ecdh-sha2-nistp256, and the client warns. The usual causes:

  • The server runs OpenSSH older than 9.0, or another SSH server that has no post-quantum exchange.
  • The server runs a newer OpenSSH, but its KexAlgorithms setting leaves both post-quantum names out.
  • The client was built without them. Check with the command below.

If the warning appeared suddenly, the usual reason is that your client was upgraded. Older clients agreed on the same algorithm without saying so.

See what was agreed

ssh -v [email protected] 2>&1 | grep 'kex: algorithm'

The line shows the agreed name, for example debug1: kex: algorithm: curve25519-sha256. To list what your client supports:

ssh -Q kex | grep -E 'mlkem|sntrup'

If that prints nothing, the client itself has no post-quantum exchange, and a newer OpenSSH package is the fix on your side.

To test whether a server supports either one, offer only those two:

ssh -o KexAlgorithms=mlkem768x25519-sha256,[email protected] [email protected]

If the server has neither, this fails with "no matching key exchange method found" instead of logging in.

Fix it on the server

If you run the server:

  1. Upgrade to OpenSSH 9.0 or later, ideally 9.9 or later so mlkem768x25519-sha256 is available. The client picks the first algorithm in its own list that the server also supports, and current clients list it first.
  2. Check the effective setting with sudo sshd -T | grep -i '^kexalgorithms'. If neither post-quantum name is in the list, a KexAlgorithms line in sshd_config or a file it includes is removing them. Remove that line, or add the names to it, then run sudo sshd -t and reload the service.

OpenSSH 10.6 added the same WarnWeakCrypto option to sshd_config. It is on by default, so the server log also gets a line like WARNING: connection from 192.0.2.10 port 50122 is not using a post-quantum key exchange algorithm: "curve25519-sha256" when a client without post-quantum support connects.

Silence it for one host

If the server cannot be changed and you accept the risk, turn the warning off for that host only, in ~/.ssh/config:

Match host legacy.example.com
  WarnWeakCrypto no-pq-kex
  • no-pq-kex turns off only this warning. WarnWeakCrypto no turns off every weak-crypto warning, including any added later.
  • For one command: ssh -o WarnWeakCrypto=no-pq-kex [email protected].
  • Clients older than 10.1 do not know WarnWeakCrypto and stop with "Bad configuration option: warnweakcrypto". If one config file is shared with older clients, put IgnoreUnknown WarnWeakCrypto near the top. See SSH "Bad configuration option" in ~/.ssh/config or sshd_config.
  • The client also skips the warning when you set KexAlgorithms yourself, in the config or with -o, because it treats that as a choice you made.
  • Avoid hiding it with ssh -q or LogLevel QUIET. That hides other useful warnings too.

If the exchange fails completely instead of warning, with "no matching key exchange method found", the two sides share no algorithm at all. That is a different problem: see SSH "no matching key exchange method" and "no matching host key type" errors.

Sources

Spotted a mistake? Email [email protected].