Skip to content

Bump ssh2 to 0.9.7 and keep the host key preference - #25

Merged
bl0rb merged 2 commits into
mainfrom
deps/ssh2-0.9.7
Nov 9, 2026
Merged

bl0rb merged 2 commits into
mainfrom
deps/ssh2-0.9.7

Conversation

@bl0rb

@bl0rb bl0rb commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Replaces #24.

ssh2 0.9.7 pulls in libssh2-sys 0.3.4. It bundles a libssh2 1.11.2_DEV snapshot with fixes for the 2025/26 libssh2 CVEs, including bugs a malicious server can trigger before login (e.g. EXT_INFO DoS, packet_length bounds, sftp_symlink OOB read, ETM/chacha20/AES-GCM overflows).

Why not #24 as is

The new libssh2 puts Ed25519 (and certificate types) ahead of ECDSA in its host-key order. sftp.rs fingerprints whichever key the server presents. On a default OpenSSH server (RSA+ECDSA+Ed25519 keys), every existing OpenSitePilot user would hit HostKeyChanged after updating, with no way in the app to recover.

Changes

  • ssh2 = "0.9.7". Cargo.lock only changes ssh2 and libssh2-sys (no unrelated re-resolution).
  • sftp.rs: a new new_session() sets method_pref(MethodType::HostKey, HOSTKEY_PREF) before the handshake. HOSTKEY_PREF is the exact libssh2 0.3.3 order, minus ssh-rsa/ssh-dss, which the new library no longer supports.
  • Handshake KEX failures now add a German hint that the server only offers outdated algorithms.
  • README (en/de): note that servers offering only SHA-1 ssh-rsa / ssh-dss host keys are no longer supported.

Verification

  • Offline tests:
    • every name in HOSTKEY_PREF is supported;
    • a fake loopback server checks the client's KEXINIT host-key list equals HOSTKEY_PREF exactly (this fails without the pin);
    • the KEX error hint.
  • Ran against local OpenSSH sshds:
    • RSA+ECDSA+Ed25519, Ed25519-only, RSA-only (rsa-sha2) and RSA+Ed25519: same host key type and fingerprint as ssh2 0.9.6;
    • SFTP write, rename, read and unlink work on all of them.
    • An ssh-rsa (SHA-1)-only server no longer connects. That is expected and documented.
  • cargo test --workspace (156 passed) and clippy are clean.

Release note

Servers that only offer SHA-1 algorithms (ssh-rsa, ssh-dss, diffie-hellman-group14-sha1, hmac-sha1), such as OpenSSH < 7.2 or old NAS/embedded devices, are no longer supported.

🤖 Generated with Claude Code

bl0rb and others added 2 commits November 9, 2026 08:39
ssh2 0.9.7 pulls libssh2-sys 0.3.4, which bundles a newer libssh2
snapshot with security fixes. That libssh2 prefers Ed25519 over ECDSA
host keys, so servers holding both would present a different key and
every stored host_key fingerprint would be reported as changed.

Pin the host key preference to the order libssh2-sys 0.3.3 used
(minus the SHA-1 ssh-rsa/ssh-dss entries the new library dropped) and
test offline that the client offers exactly that list in its KEXINIT.

Servers offering only SHA-1 algorithms (ssh-rsa, diffie-hellman-group14-sha1,
hmac-sha1) are no longer supported.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The bundled libssh2 in libssh2-sys 0.3.4 no longer supports SHA-1 ssh-rsa
or ssh-dss host keys, so servers that only offer those now fail at the key
exchange. Turn that failure into a German hint about outdated host keys
instead of passing on only libssh2's generic message, and note in both
READMEs that such servers are no longer supported.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@bl0rb
bl0rb merged commit 9d6ab6e into main Nov 9, 2026
2 checks passed
@bl0rb
bl0rb deleted the deps/ssh2-0.9.7 branch November 9, 2026 09:05
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.

1 participant