Russh is a Rust SSH client and server library. Prior to 0.62.6, the USERAUTHREQUEST path reached from server::runstream in russh/src/server/encrypted.rs increments self.common.authattempts but never compares it with server::Config.maxauthattempts. An unauthenticated remote client can continue submitting authentication requests on one connection beyond the configured cap, bypassing the deployment's attempt-limiting policy and increasing online guessing opportunity and backend authentication workload. This issue is fixed in version 0.62.6.
Russh is a Rust SSH client and server library. Prior to 0.63.1, clientreadauthenticated in russh/src/client/encrypted.rs forwards CHANNELDATA, CHANNELEXTENDEDDATA, CHANNELEOF, CHANNELCLOSE, CHANNELOPENFAILURE, CHANNELSUCCESS, CHANNELFAILURE, and CHANNELREQUEST subtypes exit-status, exit-signal, and xon-xoff to public client::Handler callbacks without confirming that the ChannelId belongs to a channel the client opened and established. A malicious SSH server can send lifecycle events for predicted, unopened, unconfirmed, or released channel identifiers, causing application panics or corrupting command completion and exit-code tracking. This issue is fixed in version 0.63.1.
Russh is a Rust SSH client and server library. Prior to 0.63.1, a connection configured to permit mac=none can negotiate it with a MAC-requiring CTR or CBC block cipher because the selection logic validates needsmac() only when MAC selection fails. A remote peer can then send a packet with a decrypted length of zero, causing russh/src/cipher/mod.rs to shrink the previously read block before indexing buffer.buffer[16..], which panics and terminates the connection task. This issue is fixed in version 0.63.1.
Russh is a Rust SSH client and server library. Prior to 0.63.2, an authenticated remote peer can send SSHMSGKEXINIT without the required SSHMSGKEXECDHINIT and then flood SSHMSGCHANNELOPEN messages while SessionKexState::InProgress prevents priorityreceiver in russh/src/server/session.rs from being drained. The server continues processing network input and enqueues a ChannelOpenReply for each request on an unbounded channel, allowing one connection to grow memory until the process is terminated. This issue is fixed in version 0.63.2.
Summary In the russh client keyboard-interactive authentication path, a malicious SSH server could send a USERAUTHINFOREQUEST with an attacker-controlled prompt count, and the client would use that raw count directly in Vec::withcapacity(...) before validating that enough prompt data was actually present in the packet.
This is a client-side denial-of-service / resource-exhaustion issue on the keyboard-interactive auth path.
Details The vulnerable code path is in:
- russh/src/client/encrypted.rs
When the client is in CurrentRequest::KeyboardInteractive state and receives SSHMSGUSERAUTHINFOREQUEST, it parses:
1. name 2. instructions 3. language tag 4. nprompts
Before the fix, the code then did:
rust let nprompts = maperr!(u32::decode(&mut r))?; let mut prompts = Vec::withcapacity(nprompts.tryinto().unwrapor(0));
That means a malicious server could advertise an enormous nprompts value even if the packet contained no prompt bodies at all.
The fix rejects inconsistent prompt counts before allocating:
rust let nprompts = maperr!(u32::decode(&mut r))?; let maxprompts = r.remaininglen() / 5; let nprompts = nprompts as usize; if nprompts > maxprompts { return Err(crate::Error::Inconsistent.into()); } let mut prompts = Vec::withcapacity(nprompts);
Each prompt needs at least 4 bytes of string length plus 1 byte of echo flag, so remaininglen() / 5 is a safe upper bound. If the declared count exceeds what the packet can actually contain, the packet is malformed and is now rejected instead of being silently truncated.
The tester did not find a same-class server-side bug in the reciprocal USERAUTHINFORESPONSE path. The server already bounds the response count by remaining packet length before allocating.
Affected package and versions:
- package: russh - earliest affected stable: 0.37.0 - confirmed affected current release: 0.60.2
The tester does not believe this issue affects the other crates in this workspace (russh-config, russh-cryptovec, pageant, or russh-util).
PoC An in-tree regression test was added:
- client::tests::oversizedkeyboardinteractivepromptcountisrejected
The test builds a client session in WaitingAuthRequest(KeyboardInteractive) state, feeds it a synthetic USERAUTHINFOREQUEST packet with:
- normal name - normal instructions - empty language tag - nprompts = u32::MAX - no prompt bodies
On the fixed code, the client rejects the packet with Error::Inconsistent and does not emit a reply to the caller.
For old-code impact verification, the pre-fix path was also checked separately with a constrained-memory repro. On unfixed upstream/main, the same malformed packet attempted a very large allocation and failed with:
text memory allocation of 137438953440 bytes failed
Relevant verification commands:
bash cargo test -p russh oversizedkeyboardinteractivepromptcountisrejected -- --nocapture cargo test -p russh --lib --no-default-features --features ring oversizedkeyboardinteractivepromptcountisrejected -- --nocapture
Impact Suggested CVSS v3.1:
- CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H - Score: 6.5
Reasoning:
- AV:N: reached by a malicious SSH server over the network - AC:L: the packet format is straightforward - PR:N: no prior authentication required - UI:R: the victim must initiate a connection and proceed into keyboard-interactive auth - C:N, I:N: Confidentiality or integrity impact were not demonstrated - A:H: the server can drive a very large allocation attempt in the client auth path, which can abort or exhaust client-side resources depending on allocator and platform behavior