Skip to content

ssh: support hybrid ML-KEM768/X25519 key exchange - #797

Draft
Seanstoppable wants to merge 1 commit into
zmap:masterfrom
Seanstoppable:ssmith/ssh-mlkem-kex
Draft

Seanstoppable wants to merge 1 commit into
zmap:masterfrom
Seanstoppable:ssmith/ssh-mlkem-kex

Conversation

@Seanstoppable

Copy link
Copy Markdown
Contributor

This PR was generated with the assistance of GitHub Copilot CLI and may require human review.

Port mlkem768x25519-sha256 from golang.org/x/crypto/ssh v0.57.0 into the SSH fork so scans can negotiate with servers that only offer hybrid post-quantum key exchange.

The port adapts upstream's implementation to the fork's per-connection instances and handshake logging, retains the upstream BSD license, and registers the algorithm in both library and scanner defaults. It also updates the JSON schema and documentation, with coverage for upstream interoperability, malformed public values, entropy failures, extensions, userauth collection, and classical compatibility.

How to Test

  • go test ./lib/ssh/... -count=1 -timeout=180s: passed.
  • go test -race ./lib/ssh ./modules -run 'TestMLKEM|TestSSH|TestKexes' -count=1 -timeout=120s: passed.
  • python3 -m zschema validate zgrab2 zgrab2_schemas/zgrab2/testdata/ssh-ssh.json --path . --module zgrab2_schemas.zgrab2: passed. Live verbose output from a PQ-only upstream Go SSH server was also validated against the updated schema.
  • go vet ./lib/ssh ./modules: failed on pre-existing testinggoroutine findings in untouched SSH test files; no findings were reported in the new files.

Notes & Caveats

The hybrid algorithm is offered after all existing classical algorithms, preserving their preference and avoiding larger hybrid exchanges when a classical alternative is available. It can be selected explicitly with --kex-algorithms=mlkem768x25519-sha256.

The scan log preserves the host key, signature, exchange hash, and hybrid server public value. Verbose output additionally includes the hybrid client public value.

This is a selective upstream port, not a full refresh or replacement of the SSH fork. It does not add sntrup761x25519-sha512@openssh.com; support for ML-KEM is sufficient for the server configuration reported in the issue. No dependency or minimum Go version changes are needed.

Issue Tracking

Fixes #796

@Vytek

Vytek commented Nov 10, 2026

Copy link
Copy Markdown

Please @codyprime review the code! We need this PR! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SSH KEX error in probe SSH

2 participants