{"id":"CVE-2026-128087","aliases":["DEBIAN-CVE-2026-128087","GHSA-9264-jvgf-6w2f","UBUNTU-CVE-2026-128087"],"summary":"russh kex_done: shared-secret callback runs before server host-key verification","published_at":"2026-11-13T19:03:26.702Z","modified_at":"2026-11-18T11:14:54Z","products":[{"slug":"rhel","name":"Red Hat Enterprise Linux","category":"red-hat"}],"rating":{"severity":"low","score":3.7,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N","attack_path":"internet_unauthenticated","user_interaction":false,"malicious":false,"red_hat":"Low","vendor_ratings":[{"source":"Red Hat","rating":"Low"}]},"fix_available":false,"kev":{"listed":false,"ransomware":false},"public_exploit":false,"exploits":[],"epss":{"score":0.0023900000378489494,"percentile":0.15059000253677368,"date":"2026-11-18T00:00:00Z"},"priority":5.7,"details":"russh is a Rust SSH client and server library that includes an SSH agent protocol implementation. From version 0.55.0 until version 0.65.1, the initial key exchange invokes client::Handler::kex_done() with the raw shared secret before check_server_key() accepts the server host key or certificate. A malicious SSH server can therefore trigger application-defined secondary-channel initialization or early data handling even when the server identity is subsequently rejected. Ordinary clients that keep the callback's no-op default or independently defer callback-derived actions until trust is confirmed are not affected. This issue is fixed in version 0.65.1.","affected_stack":[{"ecosystem":"Red Hat:hummingbird:1","package":"openshell","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"provider":"redhat-vex","source":"CVE-2026-128087","relation":"self"}],"affected_other":[{"ecosystem":"CVE","package":"Eugeny/russh","versions":[">= 0.55.0, < 0.65.1"],"provider":"cvelistv5","source":"CVE-2026-128087","relation":"self"},{"ecosystem":"Debian:14","package":"rust-russh","purl":"pkg:deb/debian/rust-russh?arch=source&distro=forky","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["0.57.1-1","0.57.1-2","0.64.1-1","0.64.1-2","0.65.1-1","0.65.1-2"],"provider":"osv","source":"DEBIAN-CVE-2026-128087","relation":"self"},{"ecosystem":"Ubuntu:26.10","package":"rust-russh","purl":"pkg:deb/ubuntu/rust-russh?arch=source&distro=stonking","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["0.57.1-2"],"provider":"osv","source":"UBUNTU-CVE-2026-128087","relation":"self"},{"ecosystem":"crates.io","package":"russh","purl":"pkg:cargo/russh","ranges":[{"type":"SEMVER","events":[{"introduced":"0.55.0"},{"fixed":"0.65.1"}]}],"fixed":["0.65.1"],"provider":"osv","source":"GHSA-9264-jvgf-6w2f","relation":"self"}],"product_status":[{"vendor":"Red Hat","product":"Red Hat Hardened Images","cpe":"cpe:/a:redhat:hummingbird:1","status":"affected","packages":["openshell"],"package_count":1,"fixed":[],"advisories":[],"note":"Affected","provider":"redhat-vex","source":"CVE-2026-128087"}],"records":[{"provider":"cvelistv5","source_id":"CVE-2026-128087","relation":"self","url":"https://www.cve.org/CVERecord?id=CVE-2026-128087","license":"CC-BY-4.0","published_at":"2026-11-13T19:03:26.702Z","modified_at":"2026-11-13T21:15:30.367Z","summary":"russh kex_done: shared-secret callback runs before server host-key verification","details":"russh is a Rust SSH client and server library that includes an SSH agent protocol implementation. From version 0.55.0 until version 0.65.1, the initial key exchange invokes client::Handler::kex_done() with the raw shared secret before check_server_key() accepts the server host key or certificate. A malicious SSH server can therefore trigger application-defined secondary-channel initialization or early data handling even when the server identity is subsequently rejected. Ordinary clients that keep the callback's no-op default or independently defer callback-derived actions until trust is confirmed are not affected. This issue is fixed in version 0.65.1.","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N","source":"CVE-2026-128087"}],"affected":[{"ecosystem":"CVE","package":"Eugeny/russh","versions":[">= 0.55.0, < 0.65.1"],"provider":"cvelistv5","source":"CVE-2026-128087","relation":"self"}],"product_status":[],"references":[{"type":"WEB","url":"https://github.com/Eugeny/russh/security/advisories/GHSA-9264-jvgf-6w2f"},{"type":"WEB","url":"https://github.com/Eugeny/russh/pull/808"},{"type":"WEB","url":"https://github.com/Eugeny/russh/commit/43a46d67a80a7355fcd2fb25e7e00d79aec8184c"},{"type":"WEB","url":"https://github.com/Eugeny/russh/releases/tag/v0.65.1"}]},{"provider":"osv","source_id":"DEBIAN-CVE-2026-128087","relation":"self","url":"https://osv.dev/vulnerability/DEBIAN-CVE-2026-128087","published_at":"2026-11-13T19:19:31.477Z","modified_at":"2026-11-14T15:00:07.294628Z","details":"russh is a Rust SSH client and server library that includes an SSH agent protocol implementation. From version 0.55.0 until version 0.65.1, the initial key exchange invokes client::Handler::kex_done() with the raw shared secret before check_server_key() accepts the server host key or certificate. A malicious SSH server can therefore trigger application-defined secondary-channel initialization or early data handling even when the server identity is subsequently rejected. Ordinary clients that keep the callback's no-op default or independently defer callback-derived actions until trust is confirmed are not affected. This issue is fixed in version 0.65.1.","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N","source":"DEBIAN-CVE-2026-128087"}],"affected":[{"ecosystem":"Debian:14","package":"rust-russh","purl":"pkg:deb/debian/rust-russh?arch=source&distro=forky","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["0.57.1-1","0.57.1-2","0.64.1-1","0.64.1-2","0.65.1-1","0.65.1-2"],"provider":"osv","source":"DEBIAN-CVE-2026-128087","relation":"self"}],"product_status":[],"references":[{"type":"ADVISORY","url":"https://security-tracker.debian.org/tracker/CVE-2026-128087"}]},{"provider":"osv","source_id":"GHSA-9264-jvgf-6w2f","relation":"self","url":"https://osv.dev/vulnerability/GHSA-9264-jvgf-6w2f","license":"CC-BY-4.0","published_at":"2026-11-13T19:20:16Z","modified_at":"2026-11-13T19:30:05.188364Z","summary":"russh kex_done: Shared-secret callback runs before server host-key verification","details":"### Summary\n\nA malicious SSH server whose host key is rejected can still cause russh's `client::Handler::kex_done()` callback to execute with the raw key-exchange shared secret. Applications using the callback for its documented protocol-bridging purpose may derive keys, initialize a secondary data channel, or perform another externally visible action before russh calls `check_server_key()` and rejects the server.\n\n### Details\n\nDuring the initial key exchange, russh calls `kex_done()` immediately after the server proves possession of the presented host key, but before the application decides whether that key belongs to the intended server:\n\n```rust\nlet shared_secret = newkeys.kex.shared_secret_bytes();\nhandler\n    .kex_done(shared_secret, &newkeys.names, session)\n    .await?;\n\n// Initial KEX only checks trust afterwards.\nif let Some(certificate) = server_host_certificate {\n    if !handler.check_server_key(&certificate.into()).await? {\n        return Err(crate::Error::UnknownKey.into());\n    }\n} else if let Some(server_host_key) = server_host_key {\n    let check = handler.check_server_key(&server_host_key.into()).await?;\n    if !check {\n        return Err(crate::Error::UnknownKey.into());\n    }\n}\n```\n\nThis is in `russh/src/client/mod.rs` at lines 2036-2078 of commit `183a22e8f8f490fa09b6eb7bd044ef99d8c4414f`.\n\nThe API documentation describes `check_server_key()` as the important trust decision that prevents man-in-the-middle attacks. It describes `kex_done()` as the callback for deriving keys for secondary encrypted channels. The feature request that introduced the callback specifically lists VPN-over-SSH, UDP data planes, file transfer, and custom enterprise transports as intended uses.\n\nCryptographic verification of the KEX signature does not establish peer identity: an attacker operating its own SSH server can always produce a valid signature with its own host key. Identity is established only when `check_server_key()` accepts that key or certificate.\n\n### Expected behavior\n\nFor the initial key exchange, `check_server_key()` should accept the server identity before `kex_done()` exposes the shared secret for secondary-channel initialization.\n\n### Actual behavior\n\n`kex_done()` runs first. An untrusted server can therefore trigger application-defined secondary-channel actions even though `check_server_key()` subsequently rejects it with `UnknownKey`.\n\nThe callback was introduced by commit `500bef1eccc1c48ac674e2a262aa7887777431eb` and is present from `v0.55.0` through current `v0.65.0`.\n\n### Proof of concept\n\nThe following self-contained Cargo project starts a local russh server with a fresh, untrusted host key. The client models the documented bridge use case by exporting the shared secret in `kex_done()`, while `check_server_key()` rejects the server. It asserts both the failed connection and the callback order.\n\nCreate an empty directory and add `Cargo.toml`:\n\n```toml\n[package]\nname = \"russh-kex-before-host-trust-poc\"\nversion = \"0.1.0\"\nedition = \"2024\"\n\n[dependencies]\nrand = { version = \"0.10\", features = [\"thread_rng\"] }\nrussh = \"=0.65.0\"\ntokio = { version = \"1\", features = [\"macros\", \"net\", \"rt-multi-thread\"] }\n```\n\nCreate `src/main.rs`:\n\n```rust\nuse std::sync::{Arc, Mutex};\n\nuse russh::keys::{Algorithm, PrivateKey, PublicKeyOrCertificate};\nuse russh::{Names, client, server};\n\n#[derive(Clone)]\nstruct TestServer;\n\nimpl server::Handler for TestServer {\n    type Error = russh::Error;\n}\n\n#[derive(Clone)]\nstruct RejectingClient {\n    events: Arc<Mutex<Vec<&'static str>>>,\n    exported_secret: Arc<Mutex<Option<Vec<u8>>>>,\n}\n\nimpl client::Handler for RejectingClient {\n    type Error = russh::Error;\n\n    async fn kex_done(\n        &mut self,\n        shared_secret: Option<&[u8]>,\n        _names: &Names,\n        _session: &mut client::Session,\n    ) -> Result<(), Self::Error> {\n        self.events.lock().unwrap().push(\"kex_done\");\n\n        // Model a bridge exporting KEX material to a secondary protocol.\n        *self.exported_secret.lock().unwrap() = shared_secret.map(ToOwned::to_owned);\n        Ok(())\n    }\n\n    async fn check_server_key(\n        &mut self,\n        _server_public_key: &PublicKeyOrCertificate,\n    ) -> Result<bool, Self::Error> {\n        self.events.lock().unwrap().push(\"check_server_key\");\n        Ok(false)\n    }\n}\n\n#[tokio::main]\nasync fn main() {\n    let mut server_config = server::Config::default();\n    server_config.inactivity_timeout = None;\n    server_config\n        .keys\n        .push(PrivateKey::random(&mut rand::rng(), Algorithm::Ed25519).unwrap());\n    let server_config = Arc::new(server_config);\n\n    let listener = tokio::net::TcpListener::bind(\"127.0.0.1:0\").await.unwrap();\n    let address = listener.local_addr().unwrap();\n    tokio::spawn(async move {\n        let (stream, _) = listener.accept().await.unwrap();\n        let _ = server::run_stream(server_config, stream, TestServer).await;\n    });\n\n    let events = Arc::new(Mutex::new(Vec::new()));\n    let exported_secret = Arc::new(Mutex::new(None));\n    let client = RejectingClient {\n        events: events.clone(),\n        exported_secret: exported_secret.clone(),\n    };\n\n    let result = client::connect(\n        Arc::new(client::Config::default()),\n        address,\n        client,\n    )\n    .await;\n\n    println!(\"connection accepted: {}\", result.is_ok());\n    println!(\"callback order: {:?}\", events.lock().unwrap());\n    println!(\n        \"secret exported before rejection: {}\",\n        exported_secret.lock().unwrap().is_some()\n    );\n\n    assert!(matches!(result, Err(russh::Error::UnknownKey)));\n    assert_eq!(\n        events.lock().unwrap().as_slice(),\n        &[\"kex_done\", \"check_server_key\"]\n    );\n    assert!(exported_secret.lock().unwrap().is_some());\n}\n```\n\nRun:\n\n```sh\ncargo run --quiet\n```\n\nObserved with russh `v0.65.0`:\n\n```text\nconnection accepted: false\ncallback order: [\"kex_done\", \"check_server_key\"]\nsecret exported before rejection: true\n```\n\nThe connection fails with `russh::Error::UnknownKey`, but the security-sensitive callback and its modeled external side effect have already occurred.\n\n### Impact\n\nApplications overriding `kex_done()` to bootstrap a secondary encrypted transport are affected. An unauthenticated attacker who can impersonate the SSH endpoint can complete KEX with an attacker-owned host key and trigger secondary channel initialization before that key is rejected. Depending on the bridge, this can expose early secondary-channel data or make the application act on a session established with an untrusted peer.\n\nOrdinary clients that leave `kex_done()` at its no-op default, or implementations that independently defer all callback-derived actions until host trust has been confirmed, are not affected.","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N","source":"GHSA-9264-jvgf-6w2f"}],"affected":[{"ecosystem":"crates.io","package":"russh","purl":"pkg:cargo/russh","ranges":[{"type":"SEMVER","events":[{"introduced":"0.55.0"},{"fixed":"0.65.1"}]}],"fixed":["0.65.1"],"provider":"osv","source":"GHSA-9264-jvgf-6w2f","relation":"self"}],"product_status":[],"references":[{"type":"WEB","url":"https://github.com/Eugeny/russh/security/advisories/GHSA-9264-jvgf-6w2f"},{"type":"WEB","url":"https://github.com/Eugeny/russh/pull/808"},{"type":"WEB","url":"https://github.com/Eugeny/russh/commit/43a46d67a80a7355fcd2fb25e7e00d79aec8184c"},{"type":"PACKAGE","url":"https://github.com/Eugeny/russh"},{"type":"WEB","url":"https://github.com/Eugeny/russh/releases/tag/v0.65.1"}]},{"provider":"osv","source_id":"UBUNTU-CVE-2026-128087","relation":"self","url":"https://osv.dev/vulnerability/UBUNTU-CVE-2026-128087","license":"CC-BY-SA-4.0","published_at":"2026-11-13T19:19:00Z","modified_at":"2026-11-18T11:14:54Z","details":"russh is a Rust SSH client and server library that includes an SSH agent protocol implementation. From version 0.55.0 until version 0.65.1, the initial key exchange invokes client::Handler::kex_done() with the raw shared secret before check_server_key() accepts the server host key or certificate. A malicious SSH server can therefore trigger application-defined secondary-channel initialization or early data handling even when the server identity is subsequently rejected. Ordinary clients that keep the callback's no-op default or independently defer callback-derived actions until trust is confirmed are not affected. This issue is fixed in version 0.65.1.","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N","source":"UBUNTU-CVE-2026-128087"},{"type":"Ubuntu","score":"medium","source":"UBUNTU-CVE-2026-128087"}],"affected":[{"ecosystem":"Ubuntu:26.10","package":"rust-russh","purl":"pkg:deb/ubuntu/rust-russh?arch=source&distro=stonking","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["0.57.1-2"],"provider":"osv","source":"UBUNTU-CVE-2026-128087","relation":"self"}],"product_status":[],"references":[{"type":"REPORT","url":"https://ubuntu.com/security/CVE-2026-128087"},{"type":"REPORT","url":"https://www.cve.org/CVERecord?id=CVE-2026-128087"},{"type":"REPORT","url":"https://github.com/Eugeny/russh/security/advisories/GHSA-9264-jvgf-6w2f"},{"type":"REPORT","url":"https://github.com/Eugeny/russh/pull/808"},{"type":"REPORT","url":"https://github.com/Eugeny/russh/commit/43a46d67a80a7355fcd2fb25e7e00d79aec8184c"},{"type":"REPORT","url":"https://github.com/Eugeny/russh/releases/tag/v0.65.1"}]},{"provider":"redhat-vex","source_id":"CVE-2026-128087","relation":"self","url":"https://access.redhat.com/security/cve/CVE-2026-128087","license":"CC-BY-4.0","published_at":"2026-11-13T19:03:26.702Z","modified_at":"2026-11-13T19:16:47Z","summary":"russh: russh: Information disclosure via premature callback execution prior to host verification","details":"A flaw was found in russh. During the initial key exchange, the library invokes client completion callbacks before verifying the server's host key or certificate. A malicious SSH server can exploit this issue to trigger early data processing or secondary-channel communication before establishing trust, potentially leading to unauthorized information disclosure.","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N","source":"CVE-2026-128087"},{"type":"Red Hat","score":"Low","source":"CVE-2026-128087"}],"affected":[{"ecosystem":"Red Hat:hummingbird:1","package":"openshell","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"provider":"redhat-vex","source":"CVE-2026-128087","relation":"self"}],"product_status":[{"vendor":"Red Hat","product":"Red Hat Hardened Images","cpe":"cpe:/a:redhat:hummingbird:1","status":"affected","packages":["openshell"],"package_count":1,"fixed":[],"advisories":[],"note":"Affected","provider":"redhat-vex","source":"CVE-2026-128087"}],"references":[{"type":"WEB","url":"https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-128087.json"},{"type":"WEB","url":"https://access.redhat.com/security/cve/CVE-2026-128087"},{"type":"WEB","url":"https://bugzilla.redhat.com/show_bug.cgi?id=2573415"},{"type":"WEB","url":"https://www.cve.org/CVERecord?id=CVE-2026-128087"},{"type":"WEB","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-128087"},{"type":"WEB","url":"https://github.com/Eugeny/russh/commit/43a46d67a80a7355fcd2fb25e7e00d79aec8184c"},{"type":"WEB","url":"https://github.com/Eugeny/russh/pull/808"},{"type":"WEB","url":"https://github.com/Eugeny/russh/releases/tag/v0.65.1"},{"type":"WEB","url":"https://github.com/Eugeny/russh/security/advisories/GHSA-9264-jvgf-6w2f"}]}],"references":[{"type":"WEB","url":"https://github.com/Eugeny/russh/security/advisories/GHSA-9264-jvgf-6w2f"},{"type":"WEB","url":"https://github.com/Eugeny/russh/pull/808"},{"type":"WEB","url":"https://github.com/Eugeny/russh/commit/43a46d67a80a7355fcd2fb25e7e00d79aec8184c"},{"type":"WEB","url":"https://github.com/Eugeny/russh/releases/tag/v0.65.1"},{"type":"ADVISORY","url":"https://security-tracker.debian.org/tracker/CVE-2026-128087"},{"type":"PACKAGE","url":"https://github.com/Eugeny/russh"},{"type":"REPORT","url":"https://ubuntu.com/security/CVE-2026-128087"},{"type":"REPORT","url":"https://www.cve.org/CVERecord?id=CVE-2026-128087"},{"type":"WEB","url":"https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-128087.json"},{"type":"WEB","url":"https://access.redhat.com/security/cve/CVE-2026-128087"},{"type":"WEB","url":"https://bugzilla.redhat.com/show_bug.cgi?id=2573415"},{"type":"WEB","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-128087"}],"sources":[{"provider":"cvelistv5","source_id":"CVE-2026-128087","url":"https://www.cve.org/CVERecord?id=CVE-2026-128087","license":"CC-BY-4.0","modified_at":"2026-11-13T21:15:30.367Z","relation":"self"},{"provider":"osv","source_id":"DEBIAN-CVE-2026-128087","url":"https://osv.dev/vulnerability/DEBIAN-CVE-2026-128087","modified_at":"2026-11-14T15:00:07.294628Z","relation":"self"},{"provider":"osv","source_id":"GHSA-9264-jvgf-6w2f","url":"https://osv.dev/vulnerability/GHSA-9264-jvgf-6w2f","license":"CC-BY-4.0","modified_at":"2026-11-13T19:30:05.188364Z","relation":"self"},{"provider":"osv","source_id":"UBUNTU-CVE-2026-128087","url":"https://osv.dev/vulnerability/UBUNTU-CVE-2026-128087","license":"CC-BY-SA-4.0","modified_at":"2026-11-18T11:14:54Z","relation":"self"},{"provider":"redhat-vex","source_id":"CVE-2026-128087","url":"https://access.redhat.com/security/cve/CVE-2026-128087","license":"CC-BY-4.0","modified_at":"2026-11-13T19:16:47Z","relation":"self"}]}
