{"id":"CVE-2026-42189","aliases":["CVE-2026-42189","GHSA-f5v4-2wr6-hqmg","RUSTSEC-2026-0496"],"related":[],"kind":"vulnerability","state":"published","title":"Russh: Pre-auth DoS via unbounded allocation in keyboard-interactive auth","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nA 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.\n\n## Vulnerability Details\n\nIn `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()`:\n\n```rust\nlet n = map_err!(u32::decode(r))?;\n\n// Bound both allocation and iteration by remaining packet data to\n// prevent a malicious client from causing a multi-GB allocation or\n// billions of loop iterations with a crafted count.\n// Each response needs at least 4 bytes (length prefix).\nlet max_responses = r.remaining_len().saturating_add(3) / 4;\nlet n = (n as usize).min(max_responses);\nlet mut responses = Vec::with_capacity(n);\nfor _ in 0..n {\n    responses.push(Bytes::decode(r).ok())\n}\n```\n\nAn 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.\n\n## Attack Flow\n\n1. Attacker connects via TCP, completes key exchange (no credentials needed -- this is the anonymous DH handshake, not authentication)\n2. Sends `USERAUTH_REQUEST` with method `keyboard-interactive`\n3. Server handler returns `Auth::Partial` with prompts (standard for 2FA/TOTP)\n4. Attacker sends `USERAUTH_INFO_RESPONSE` with `n = 0x10000000` and no response data\n5. Server calls `Vec::with_capacity(268_435_456)`, OOM killed\n\nNo authentication is required. The allocation occurs before the handler validates any credentials. The attack is repeatable faster than the server can restart.\n\n## Affected Configurations\n\nAny 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.\n\nSource 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.\n\n## Confirmed End-to-End PoC\n\nThere is a complete Docker-contained PoC confirming the OOM kill:\n- Minimal russh server returning `Auth::Partial` for keyboard-interactive\n- Python client (paramiko for key exchange) sends malformed `USERAUTH_INFO_RESPONSE`\n- Container with 512MB memory limit; server is OOM-killed (exit code 137)\n\nAvailable on request.\n\n## Proposed Fix\n\nCap the `Vec::with_capacity` allocation to what the remaining packet data can actually contain. Each response requires at least 4 bytes (length prefix), so:\n\n```rust\nlet n = map_err!(u32::decode(r))?;\n\n// Bound both allocation and iteration by remaining packet data to\n// prevent a malicious client from causing a multi-GB allocation or\n// billions of loop iterations with a crafted count.\n// Each response needs at least 4 bytes (length prefix).\nlet max_responses = r.remaining_len().saturating_add(3) / 4;\nlet n = (n as usize).min(max_responses);\nlet mut responses = Vec::with_capacity(n);\nfor _ in 0..n {\n    responses.push(Bytes::decode(r).ok())\n}\n```\n\nThis 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.\n\n## Severity\n\nPre-auth, remote, no credentials required, crashes the server process affecting all active sessions.","format":"markdown","source":"ghsa"},{"lang":"en","text":"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.\n\nServers 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.","format":"markdown","source":"rustsec"},{"lang":"es","text":"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.","source":"nvd"}],"published":"2026-04-24T12:00:00.000Z","modified":"2026-11-12T08:10:55.931Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"RustSec Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"}],"cwes":["CWE-770","CWE-789"],"affected":[{"ranges":[{"version":"< 0.60.1","status":"affected"}],"vendor":"Eugeny","product":"russh","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.60.1"}],"ecosystem":"crates.io","package":"russh","purl":"pkg:cargo/russh","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0.0.0-0","status":"affected","fixed":"0.60.1"}],"ecosystem":"crates.io","package":"russh","purl":"pkg:cargo/russh","source":"rustsec"},{"ranges":[{"status":"affected","fixed":"0.60.1"}],"vendor":"russh_project","product":"russh","cpe":"cpe:2.3:a:russh_project:russh:*:*:*:*:*:rust:*:*","source":"nvd"},{"ranges":[{"status":"affected","fixed":"0.23.1"}],"vendor":"warpgate_project","product":"warpgate","cpe":"cpe:2.3:a:warpgate_project:warpgate:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/Eugeny/russh/security/advisories/GHSA-f5v4-2wr6-hqmg","tags":["exploit","mitigation","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/Eugeny/russh/commit/6c3c80a9b6d60763d6227d60fa8310e57172a4d1","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","rustsec","nvd"]},{"url":"https://github.com/Eugeny/russh/releases/tag/v0.60.1","tags":["product","release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-42189","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/Eugeny/russh","tags":["package"],"sources":["ghsa"]},{"url":"https://crates.io/crates/russh","tags":["package"],"sources":["rustsec"]},{"url":"https://rustsec.org/advisories/RUSTSEC-2026-0496.html","tags":["advisory"],"sources":["rustsec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2026-05-11T14:23:22.063Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-42189","url":"https://www.cve.org/CVERecord?id=CVE-2026-42189","licence":"CVE Terms of Use","modified":"2026-05-11T14:23:49.308Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-f5v4-2wr6-hqmg","url":"https://github.com/advisories/GHSA-f5v4-2wr6-hqmg","licence":"CC-BY-4.0","modified":"2026-11-12T08:10:55.931Z"},{"source":"rustsec","name":"RustSec Advisory Database","id":"RUSTSEC-2026-0496","url":"https://rustsec.org/advisories/RUSTSEC-2026-0496.html","licence":"CC0-1.0","modified":"2026-11-12T08:00:04.107Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-42189","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-42189","licence":"Public domain","modified":"2026-10-26T18:10:00.173Z"}],"updatedAt":"2026-11-25T22:59:21.110Z","epss":{"score":0.00481,"percentile":0.43117,"date":"2026-12-01T12:00:22.000Z"}}