7.5high
Russh: Pre-auth DoS via unbounded allocation in keyboard-interactive auth
- Severity
- 7.5high CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.48% (higher than 43% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-f5v4-2wr6-hqmgRUSTSEC-2026-0496
Description
Russh is a Rust SSH client & server library. Prior to version 0.60.1, a pre-authentication denial-of-service vulnerability exists in the server's keyboard-interactive authentication handler. A malicious client can crash any russh-based server that implements keyboard-interactive auth (e.g., for 2FA/TOTP) with a single malformed packet, requiring no credentials. This issue has been patched in version 0.60.1.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| Eugeny russh | < 0.60.1 | CVE List |
| russh (crates.io) | before 0.60.1, from 0.0.0-0 before 0.60.1 | GitHub Advisory Database, RustSec Advisory Database |
| russh_project russh | before 0.60.1 | NVD |
| warpgate_project warpgate | before 0.23.1 | NVD |
All scores
| GitHub_M | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| GitHub | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| RustSec Advisory Database | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
Classification
What each source says
CVE List
Russh is a Rust SSH client & server library. Prior to version 0.60.1, a pre-authentication denial-of-service vulnerability exists in the server's keyboard-interactive authentication handler. A malicious client can crash any russh-based server that implements keyboard-interactive auth (e.g., for 2FA/TOTP) with a single malformed packet, requiring no credentials. This issue has been patched in version 0.60.1.
GitHub Advisory Database
Summary
A pre-authentication denial-of-service vulnerability exists in the server's keyboard-interactive authentication handler. A malicious client can crash any russh-based server that implements keyboard-interactive auth (e.g., for 2FA/TOTP) with a single malformed packet, requiring no credentials.
Vulnerability Details
In russh/src/server/encrypted.rs, the function read_userauth_info_response decodes a u32 count from the client's SSH_MSG_USERAUTH_INFO_RESPONSE and passes it directly to Vec::with_capacity():
let n = map_err!(u32::decode(r))?;
// Bound both allocation and iteration by remaining packet data to
// prevent a malicious client from causing a multi-GB allocation or
// billions of loop iterations with a crafted count.
// Each response needs at least 4 bytes (length prefix).
let max_responses = r.remaining_len().saturating_add(3) / 4;
let n = (n as usize).min(max_responses);
let mut responses = Vec::with_capacity(n);
for _ in 0..n {
responses.push(Bytes::decode(r).ok())
}
An attacker can send n = 0x10000000 (268M) or larger in a minimal packet (~50 bytes after encryption). The server attempts to allocate n * ~24 bytes (size of Option<Bytes>) = ~6.4GB, causing an OOM crash.
Attack Flow
- Attacker connects via TCP, completes key exchange (no credentials needed -- this is the anonymous DH handshake, not authentication)
- Sends
USERAUTH_REQUESTwith methodkeyboard-interactive - Server handler returns
Auth::Partialwith prompts (standard for 2FA/TOTP) - Attacker sends
USERAUTH_INFO_RESPONSEwithn = 0x10000000and no response data - Server calls
Vec::with_capacity(268_435_456), OOM killed
No authentication is required. The allocation occurs before the handler validates any credentials. The attack is repeatable faster than the server can restart.
Affected Configurations
Any russh-based server where the Handler::auth_keyboard_interactive implementation returns Auth::Partial (i.e., sends prompts to the client). The default handler returns Auth::reject() and is not affected.
Source code review suggests that downstream projects using keyboard-interactive for multi-step auth (e.g., TOTP/2FA) follow the affected pattern, since returning Auth::Partial before credential verification is the intended API usage for prompting.
Confirmed End-to-End PoC
There is a complete Docker-contained PoC confirming the OOM kill:
- Minimal russh server returning
Auth::Partialfor keyboard-interactive - Python client (paramiko for key exchange) sends malformed
USERAUTH_INFO_RESPONSE - Container with 512MB memory limit; server is OOM-killed (exit code 137)
Available on request.
Proposed Fix
Cap the Vec::with_capacity allocation to what the remaining packet data can actually contain. Each response requires at least 4 bytes (length prefix), so:
let n = map_err!(u32::decode(r))?;
// Bound both allocation and iteration by remaining packet data to
// prevent a malicious client from causing a multi-GB allocation or
// billions of loop iterations with a crafted count.
// Each response needs at least 4 bytes (length prefix).
let max_responses = r.remaining_len().saturating_add(3) / 4;
let n = (n as usize).min(max_responses);
let mut responses = Vec::with_capacity(n);
for _ in 0..n {
responses.push(Bytes::decode(r).ok())
}
This bounds the allocation to at most the packet size (~256KB), while preserving the existing behavior for well-formed packets. This fix has been implemented, tested, and contributed via the temporary private fork.
Severity
Pre-auth, remote, no credentials required, crashes the server process affecting all active sessions.
RustSec Advisory Database
A server that answers a keyboard-interactive authentication request with prompts (Auth::Partial, as a TOTP or other second-factor login does) then parses the client's SSH_MSG_USERAUTH_INFO_RESPONSE. russh read the number of responses from that message and reserved a vector of that many entries before reading any of them. A client that has not authenticated can send a very large count in a packet that carries no responses at all, and the server tries to allocate several gigabytes and may be killed for running out of memory.
Servers whose handler keeps the default behaviour, which rejects keyboard-interactive authentication, are not affected. From 0.60.1 the count is limited by how many responses the remaining packet data could actually hold.
NVD (es)
Russh es una biblioteca de cliente y servidor SSH de Rust. Antes de la versión 0.60.1, existe una vulnerabilidad de denegación de servicio de preautenticación en el gestor de autenticación interactiva por teclado del servidor. Un cliente malicioso puede bloquear cualquier servidor basado en Russh que implemente autenticación interactiva por teclado (p. ej., para 2FA/TOTP) con un único paquete malformado, sin requerir credenciales. Este problema ha sido parcheado en la versión 0.60.1.
References
| https://github.com/Eugeny/russh/security/advisories/GHSA-f5v4-2wr6-hqmg | exploit, mitigation, vendor-advisory, web | |
| https://github.com/Eugeny/russh/commit/6c3c80a9b6d60763d6227d60fa8310e57172a4d1 | patch, web | |
| https://github.com/Eugeny/russh/releases/tag/v0.60.1 | product, release-notes, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2026-42189 | advisory | |
| https://github.com/Eugeny/russh | package | |
| https://crates.io/crates/russh | package | |
| https://rustsec.org/advisories/RUSTSEC-2026-0496.html | advisory | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-42189 changed 2026-05-11 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-f5v4-2wr6-hqmg changed 2026-11-12 | CC-BY-4.0 |
| RustSec Advisory Database | RUSTSEC-2026-0496 changed 2026-11-12 | CC0-1.0 |
| NVD | CVE-2026-42189 changed 2026-10-26 | Public domain |