Post-quantum SSH: enable mlkem768x25519-sha256 in minutes
How to check and enable post-quantum key exchange in OpenSSH: which versions support mlkem768x25519-sha256, exact KexAlgorithms lines, and how to verify it.
Published 5 min readBy Imad Ez
On this page
To get post-quantum SSH, run OpenSSH 9.9 or later and make sure mlkem768x25519-sha256 is in your KexAlgorithms list. From OpenSSH 10.0 it is the default, so on a current system the work is usually to check that nobody pinned an old classical-only list. OpenSSH has had a post-quantum hybrid, sntrup761x25519-sha512, as the default since 9.0, so even older servers may already be protected. This takes about ten minutes plus a staged rollout.
What is protected, and what is not
SSH sessions carry commands, secrets and file transfers. A recorded session whose key exchange used classical elliptic curves can be decrypted later by a quantum computer: harvest now, decrypt later. The hybrid key exchange fixes that. It combines X25519 with a post-quantum KEM, so the session stays safe if either one holds.
SSH host keys and user keys (Ed25519, RSA, ECDSA) are signatures. They are not harvestable; forging one needs a quantum computer at connection time. OpenSSH has no standardized post-quantum signature key type that we could verify, so those stay classical for now. The urgent piece is the key exchange.
What the release notes say
From the OpenSSH release notes:
| Version | Change |
|---|---|
| 9.0 (April 2022) | Hybrid Streamlined NTRU Prime and x25519, sntrup761x25519-sha512@openssh.com, used by default |
| 9.9 (September 2024) | New hybrid ML-KEM and X25519: mlkem768x25519-sha256 "is available by default" |
| 10.0 | "the hybrid post-quantum algorithm mlkem768x25519-sha256 is now used by default for key agreement" |
mlkem768x25519-sha256 is the NIST-standardized ML-KEM-768 combined with X25519. sntrup761x25519-sha512 is a non-NIST lattice hybrid with a long deployment history. Either is better than classical-only.
Step 1: check your client
ssh -V
ssh -Q kex | grep -E "mlkem|sntrup"
On our test machine (OpenSSH 10.2p1) this lists sntrup761x25519-sha512, sntrup761x25519-sha512@openssh.com and mlkem768x25519-sha256 (tested). If the grep returns nothing, upgrade.

See the effective list and its order for a given host, including anything in your config files:
ssh -G example.com | grep -i "^kexalgorithms"
Order matters. On the same test machine, the effective default list put ecdh-sha2-nistp256 first, with the ML-KEM hybrid second (tested). The client offers algorithms in order and the server picks the first one it also supports in the client's order, so a classical entry at the front can win. Inspect the list instead of assuming.
Step 2: check what a server negotiates
ssh -vv user@server.example 2>&1 | grep "kex: algorithm"
The line shows the algorithm chosen, for example kex: algorithm: mlkem768x25519-sha256. We tested the client side. We did not test the success path against a remote server here, so run it against a system you own.
Step 3: set it explicitly where you must
If you have no pin in sshd_config or ssh_config, a current OpenSSH needs no change. If you do pin, or are on 9.9, set a list with the hybrids first (client capability tested; server-side behaviour untested):
# /etc/ssh/sshd_config
KexAlgorithms mlkem768x25519-sha256,sntrup761x25519-sha512,curve25519-sha256
# ~/.ssh/config
Host *
KexAlgorithms mlkem768x25519-sha256,sntrup761x25519-sha512,curve25519-sha256
Keep curve25519-sha256 last only while old clients need it. Once every client supports a hybrid, remove it to enforce post-quantum exchange. A smoother way to stay current is to add and remove entries relative to the defaults using the + and - prefixes, for example KexAlgorithms -curve25519-sha256. Test this on one host first.
Validate and reload without dropping your session:
sudo sshd -t && sudo systemctl reload sshd
Keep a second session open while you test a new login. A syntax error that stops sshd from reloading is how people lock themselves out.
What to watch for
- Old clients and network devices. Embedded devices, older Java SSH libraries and some appliances only speak classical key exchange. If you remove the classical fallback they will stop connecting. Inventory before enforcing.
- Jump hosts and bastions. Each hop negotiates its own exchange. Protecting the first hop does not protect the second.
- Managed services. Git hosting, file transfer and cloud shells set their own server policy. Ask the provider.
- Automation. CI systems often pin
KexAlgorithmscopied from a hardening guide years ago. Search your configuration management for it.
Rolling it out across a fleet
- Upgrade first, configure second. On OpenSSH 10.0 or later with no pins, you are done once the package is current. Find the hosts that are not:
ssh -Vthrough your configuration management gives a version inventory in minutes. - Canary. Change
KexAlgorithmson a handful of non-critical hosts and connect from every client type you operate: laptops, CI runners, backup agents, monitoring, deployment tools. Look forno matching key exchange method foundin client output and in the server log. - Widen in rings. Internal hosts, then bastions, then production. Keep the classical fallback until the failure rate has been zero for a few weeks.
- Enforce last. Removing
curve25519-sha256is the step that blocks old clients. Announce it, give a date, and have a documented exception path for the few devices that cannot upgrade; isolate those rather than leaving the whole fleet on the weaker list. - Keep evidence. Save the
ssh -Goutput and a samplekex: algorithmline per host class. It is the proof you will want when an auditor or a customer asks.
Troubleshooting
no matching key exchange method found. The client and server share no algorithm. Runssh -Q kexon both sides and compare; the older side needs an upgrade or the classical fallback.- The hybrid is listed but not chosen. Check the order with
ssh -G host. A classical entry earlier in the list can win, as it did on our test machine. - Config change has no effect.
Matchblocks and included files inssh_configorsshd_configcan override a global line. Usesudo sshd -T | grep -i kexalgorithmson the server to see the effective value. - Hangs during key exchange. Rare, usually a middlebox mishandling larger packets. Test from a different network path before blaming OpenSSH.
Next steps
Find where classical-only lists are pinned in your repositories with the code scanner (see finding quantum-vulnerable crypto), and see the same pattern for web traffic in enable post-quantum TLS. Explore how a KEM works in the KEM playground. If you want help auditing SSH across a fleet, you can contact a specialist via /en/contact.