//nefariousplan

CVE-2026-48110: Russh's April Patch Named the May Bug

vendor

pattern

cve

proof of concept

Russh's April 20 patch for a denial-of-service bug on the server side of keyboard-interactive authentication shipped with a commit message that named the bug class out loud. "Response count was read as a u32 from the client and passed directly to Vec::with_capacity(), allowing a malicious client to trigger a multi-GB allocation with a single small packet, crashing the server via OOM." The patched function was read_userauth_info_response in russh/src/server/encrypted.rs. The mirror image of that bug, the same Vec::with_capacity call against the same kind of untrusted u32, sat in russh/src/client/encrypted.rs on the same release.

Thirty days later, on May 20, russh merged the fix for CVE-2026-48110. The patch is the mirror image of April's, in the file next door, by a different author.

At v0.60.3, after the April patch shipped and before the May patch landed, the russh crate contained exactly two calls to Vec::with_capacity in non-test code, across 21,387 lines of source. One had a remaining_len() bound written above it. The other was CVE-2026-48110.

Russh's April 20 patch for a denial-of-service bug on the server side of keyboard-interactive authentication shipped with a commit message that named the bug class out loud. "Response count was read as a u32 from the client and passed directly to Vec::with_capacity(), allowing a malicious client to trigger a multi-GB allocation with a single small packet, crashing the server via OOM." The patched function was read_userauth_info_response in russh/src/server/encrypted.rs. The mirror image of that bug, the same Vec::with_capacity call against the same kind of untrusted u32, sat in russh/src/client/encrypted.rs on the same release.

Thirty days later, on May 20, russh merged the fix for CVE-2026-48110. The patch is the mirror image of April's, in the file next door, by a different author.

At v0.60.3, after the April patch shipped and before the May patch landed, the russh crate contained exactly two calls to Vec::with_capacity in non-test code, across 21,387 lines of source. One had a remaining_len() bound written above it. The other was CVE-2026-48110.

The April commit message named the bug class out loud

The April fix landed in russh as commit 6c3c80a, released in v0.60.1. The commit's title is the SCM placeholder GitHub uses for security-advisory PRs: "Merge commit from fork." The commit body is precise:

Bound both the Vec allocation and loop iteration count by the remaining packet data when parsing SSH_MSG_USERAUTH_INFO_RESPONSE. Previously, the response count was read as a u32 from the client and passed directly to Vec::with_capacity(), allowing a malicious client to trigger a multi-GB allocation with a single small packet, crashing the server via OOM.

The fix caps the count to the maximum number of responses that could fit in the remaining packet data (each needs at least 4 bytes for a length prefix), bounding allocation to at most the packet size (~256KB).

The diff is six lines of meaningful change:

 if let Some(CurrentRequest::KeyboardInteractive { ref submethods }) = auth_request.current {
     let n = map_err!(u32::decode(r))?;

-    let mut responses = Vec::with_capacity(n as usize);
+    // 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())
     }

The shape of the bug is fully described in those four comment lines. An attacker-controlled u32 field in an SSH message reaches Vec::with_capacity() without ever being checked against the size of the message that contains it. SSH packets are bounded at around 256 KB. The count field is bounded only by the type, four billion and change. A four-byte field tells the allocator to reserve gigabytes.

The April patch is the kind of fix a code reviewer can verify in thirty seconds. Cap the count by what the packet could actually contain. Per-element minimum size is 4 bytes (the length prefix on a string). remaining_len() / 4 is the ceiling. min() it. Done.

The fix does not introduce a helper. It inlines the bound at the bug site. Every other decoder that calls u32::decode and feeds the result to a Vec::with_capacity is, on April 21, still unbounded. That is the design.

The same shape, in the file next door

Russh implements both sides of the SSH wire. russh/src/server/encrypted.rs is the handler dispatch for messages the server receives. russh/src/client/encrypted.rs is the handler dispatch for messages the client receives. The two files are siblings. They handle opposite ends of the same protocol exchanges.

Keyboard-interactive authentication (RFC 4256) has two halves. The server sends SSH_MSG_USERAUTH_INFO_REQUEST with a list of prompts the user must answer. The client returns SSH_MSG_USERAUTH_INFO_RESPONSE with a list of strings, one per prompt. Both messages carry a u32 count followed by that many fields.

April fixed the server's response handler. The client's request handler, at russh/src/client/encrypted.rs:166 in v0.60.3, looked like this:

} else if let Some(auth::CurrentRequest::KeyboardInteractive {
    ..
}) = auth_request.current
{
    debug!("keyboard_interactive");

    // read fields
    let name = map_err!(String::decode(&mut r))?;
    let instructions = map_err!(String::decode(&mut r))?;
    let _lang = map_err!(String::decode(&mut r))?;
    let n_prompts = map_err!(u32::decode(&mut r))?;

    // read prompts
    let mut prompts =
        Vec::with_capacity(n_prompts.try_into().unwrap_or(0));
    for _i in 0..n_prompts {
        let prompt = map_err!(String::decode(&mut r))?;
        let echo = map_err!(u8::decode(&mut r))? != 0;
        prompts.push(Prompt {
            prompt: prompt.to_string(),
            echo,
        });
    }
    map_err!(ensure_end(&r))?;

The decode reads three strings and a u32. The u32 is n_prompts. The u32 is passed to Vec::with_capacity through .try_into().unwrap_or(0). The .try_into().unwrap_or(0) looks defensive and is not. u32::try_into::<usize>() cannot fail on any platform russh runs on, so the unwrap_or(0) branch is unreachable. The Vec::with_capacity receives the full u32 widened to usize.

A Prompt is a String plus a bool, 32 bytes after padding on a 64-bit target. Vec::with_capacity(u32::MAX as usize) requests 4_294_967_295 * 32 bytes, roughly 137 GB. The Rust allocator returns failure. The Vec growth path on allocation failure aborts the process.

A single SSH packet from the server kills the client.

The May fix is structurally identical to April's:

-                                let mut prompts =
-                                    Vec::with_capacity(n_prompts.try_into().unwrap_or(0));
+                                // Each prompt needs at least a 4-byte length plus a 1-byte echo flag.
+                                let max_prompts = r.remaining_len() / 5;
+                                let n_prompts = n_prompts as usize;
+                                if n_prompts > max_prompts {
+                                    return Err(crate::Error::Inconsistent.into());
+                                }
+                                let mut prompts = Vec::with_capacity(n_prompts);

Cap the count by remaining_len() divided by the per-element minimum size. Per-element minimum is 5 this time (a 4-byte length prefix plus a 1-byte echo flag) instead of 4. The cap is otherwise the same shape. The inline comment is the same shape.

April's per-element minimum was four bytes. May's is five. The patch math diverges on exactly one digit.

What a malicious SSH server sends

The keyboard-interactive flow starts when the russh client sends SSH_MSG_USERAUTH_REQUEST with method = "keyboard-interactive". Russh clients that allow keyboard-interactive as an authentication option route every connection's auth phase through this handler. The default examples in the russh repository include keyboard-interactive in the methods list.

After receiving the auth request, a malicious SSH server responds:

byte      SSH_MSG_USERAUTH_INFO_REQUEST  (60)
string    ""                              (name)
string    ""                              (instructions)
string    ""                              (language)
uint32    0xFFFFFFFF                      (num_prompts)

The packet is 17 bytes plus the message-type byte and SSH framing. Total wire size under 50 bytes.

The russh client decodes the three empty strings, reads n_prompts = 4_294_967_295, and calls Vec::with_capacity(4_294_967_295). The Rust allocator either grants overcommitted virtual memory that will OOM-kill the process on first touch, or fails the allocation immediately and the RawVec allocation-failure handler aborts. The russh client process is dead before it reads any of the prompts the request claimed to contain.

CVSS records this as AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H. The PR:N is correct from the attacker's vantage. The attacker is an SSH endpoint. No credentials are required to be an SSH endpoint. Any russh-based SSH client that connects to an attacker-controlled host and offers keyboard-interactive as an auth method is killed by a single inbound packet during the auth phase.

The reach is the set of programs that link russh and act as SSH clients. That includes git-over-SSH front-ends, SFTP tooling, automated backup clients, and admin tools that drive remote shells. The attack does not require the attacker to be on the target network, host the target server, or hold any credential. It requires only that the target connect to an SSH service the attacker controls.

The grep was already on the maintainer's screen

After the April patch lands in v0.60.1, this command is the audit:

$ grep -rn "Vec::with_capacity" russh/src/
russh/src/server/encrypted.rs:531:        let mut responses = Vec::with_capacity(n);
russh/src/client/encrypted.rs:166:                                    Vec::with_capacity(n_prompts.try_into().unwrap_or(0));

Two lines. 21,387 lines of Rust in russh/src/. The grep returns exactly two matches outside test code.

Match one is line 531 of server/encrypted.rs. Six lines above it is the April patch's bound. The match exists because someone reading the file in April typed it.

Match two is line 166 of client/encrypted.rs. There is no bound above it. The local variable being passed to with_capacity is named n_prompts and was decoded as a u32 from the wire four lines earlier. The shape is identical to the bug the April patch closed. The shape is identical to the bug the April commit message described in plain English.

The grep that finds the next instance is the same grep that finds the patched one. A reviewer who pulls up Vec::with_capacity to verify April's fix is looking at the May bug in the second pane.

Russh's April fix shipped as a private security advisory PR ("Merge commit from fork" is GitHub's marker for private security-advisory branches). The advisory workflow surfaces the file the patch touches. It does not enforce a grep across the rest of the codebase. The author of the April fix and the author of the May fix are different humans. The April author closed an instance. The May author found the instance the April patch had named.

Russh shipped v0.60.1, v0.60.2, and v0.60.3 with the second match unbounded.

Russh's decode path is the substrate

This is the design-debt-driver shape. Russh's decode path is the component, and "decode an untrusted u32, feed it directly to a Vec sizing function" is the bug class. The class has produced exhibits.

GHSA-vgvv-x7xg-6cqg, fixed in v0.44.1 (August 2024). The vulnerable site was the SSH packet length parser in russh/src/cipher/mod.rs. The fix added a bound check on a u32 length field read off the wire before it was used to size a buffer. Same shape, different decoder, in the lowest layer of the stack.

The April 2026 fix in read_userauth_info_response. The May 2026 fix in the keyboard-interactive client handler. Two patches, one month apart, on the same protocol exchange, on opposite sides.

Three CVEs from the same shape over twenty-two months. Each fix is an inline bound at the bug site. Russh does not have a decode_bounded_vec helper. Russh's helpers.rs defines read_prefixed for byte strings, but nothing for length-prefixed sequences of typed values. Every decoder that consumes a count writes the bound check itself, or does not write one and ships the next instance of this class.

The substrate is the pattern let n = u32::decode(r)?; Vec::with_capacity(n). The pattern is written one inlined fix at a time. The patches addressed instances. The substrate held the primitive. The next decoder added by a contributor who does not know to grep Vec::with_capacity will produce the next instance.

The SSH protocol has more length-prefixed sequences than this. Channel open requests carry counts. KEXINIT carries name-lists. Extension exchange carries entry counts. Each of those is a decoder that, written without a shared bounded helper, can repeat the bug. The April patch is documentation of how to write the bound inline. It is not enforcement of the bound across the codebase.

PoC: Eugeny/russh commit 311f6cf (fix), advisory GHSA-4r3c-5hpg-58qr.

The April patch wrote the grep. Nobody ran it.