fix(security): verify the server host key presented on re-key

オープン
#336 コメント 0 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@inureyes がすでに取り組んでいます。

2026年11月5日 から。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
cli, security

調査の方向性

Read docs/openssh-compatibility-status.md and inspect the SSH client handler in src/ssh/tokio_client/connection.rs, along with the russh re-key behavior described in the issue. First determine when a released russh version exposes the re-key host key; then implement the stated verification behavior and add a scripted or in-process server test that changes its host key. Done means the test rejects a changed key until bssh verifies it, and the compatibility status records the upstream version and gap.

索引モデルが issue の本文から書いたものです。

説明

priority:low status:blocked type:security

Problem

OpenSSH 10.3p1 verifies the host key on every key exchange, re-keys included: kex_verify_host_key (kex.c:1189) is called from kexgen.c:167 and kexgexc.c:169. verify_host_key (sshconnect.c) skips the check only when the key equals previous_host_key (sshconnect.c:1497, cached at 1564-1565). A different key on re-key goes through known_hosts, KnownHostsCommand, RevokedHostKeys and CA rules again.

russh 0.64.1 calls Handler::check_server_key only on the initial exchange (src/client/mod.rs around 2005-2021, the else branch of if session.common.encrypted.is_some()). On a re-key it verifies the exchange signature with the presented key (src/client/kex.rs:337) but never passes that key or certificate to the handler. bssh's handler (src/ssh/tokio_client/connection.rs:3744) never sees it, so the re-key host key is accepted unchecked.

Severity

Low: a re-key runs inside the encrypted transport, so a network attacker cannot inject a key without the session keys. The gap matters for a server that changes or loses its key mid-session, and for parity with OpenSSH policy (RevokedHostKeys, the host-key type match added in #333).

Blocked on upstream

bssh consumes only released upstream russh, with no fork (dependency boundary in docs/openssh-compatibility-status.md). russh must first either call check_server_key (or a new re-key callback) on re-key, or expose the re-key host key to the client. #327 is blocked for the same handler-visibility reason (russh PR #794).

Acceptance Criteria

  • A released upstream russh version exposes the re-key host key or certificate to the client handler, and that version is recorded in docs/openssh-compatibility-status.md.
  • bssh accepts a re-key whose host key equals the key verified at connection start without re-running verification, and runs the full verification (the check_server_key path, including certificates, RevokedHostKeys and the negotiated-algorithm type match) when the key differs, failing the connection on rejection.
  • A test against a scripted or in-process server that changes its host key on re-key fails before the change and passes after.
  • Until upstream lands, docs/openssh-compatibility-status.md lists this gap as its own entry (today it is only a sentence in the host-certificate paragraph).
主要言語
Rust
スター
71
フォーク
7
平均マージ
4時間 51分
マージ済み PR(30日)
14

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

lablup/bssh のほかの issue

lablup/bssh の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。