Oct 1, 2026·5 min read·17 visits
Authenticated remote peers can trigger unbounded memory growth in russh by starting a rekey, stalling the handshake, and flooding connection-layer packets which accumulate in an undrained heap queue.
An uncontrolled resource consumption vulnerability in the russh library allows remote authenticated attackers to exhaust server memory (heap) by flooding channel open requests during a stalled key re-exchange (rekeying) process, causing a denial of service via Out-of-Memory (OOM) termination.
The russh library is an asynchronous Rust implementation of the SSH2 protocol, built atop the tokio framework. It serves as an underlying engine for SSH clients, servers, port-forwarding proxies, and file transfer systems. Prior to version 0.63.2, the library contains a state-gating flaw in its session-handling layer.
When a key re-exchange (rekeying) is initiated, the connection state transitions to an active negotiation phase. To maintain compliance with SSH protocol specifications, specifically RFC 4253 Section 7.1, the server suspends the outbound processing and polling of connection-layer channels. This suspension is intended to prevent the interleaving of data traffic with cryptographic key exchange packets.
However, while the outbound queue processing is disabled, the incoming socket reader continues to receive and process packets. This mismatch allows an authenticated client to flood connection-layer requests, such as channel open messages. Because the server cannot transmit the responses, it queues them in an unbounded memory buffer, resulting in memory exhaustion.
The root cause lies in the asymmetrical gating of the network event loop during the key re-exchange sequence. In russh/src/server/session.rs, when a rekey begins, the session state transitions to SessionKexState::InProgress(kex). While in this state, the server stops polling the internal priority_receiver channel to ensure protocol order compliance.
Despite the outbound queue being blocked, the main event loop in russh/src/server/mod.rs continues to read and decrypt packets from the active TCP socket. When an authenticated client transmits a channel open message (SSH_MSG_CHANNEL_OPEN), the server processes the payload. It generates a corresponding rejection or acknowledgment packet and pushes it into the priority_sender channel.
Because priority_receiver is an unbounded Multi-Producer Single-Consumer (MPSC) channel, and its draining mechanism is completely suspended, every incoming request causes a new response to accumulate in heap memory. The attacker controls the rate and quantity of these allocations, leading to linear memory growth.
The vulnerability was resolved in commit a282af361ac99bc76b80876d1aae128e89dbf66b by introducing state validation and accounting limits on pending packet sizes during key negotiation. Below is a comparison of the mitigation introduced in the core packet processing function.
// In russh/src/server/mod.rs and russh/src/client/mod.rs
// The patch validates the incoming packet against the KEX state
if !is_kex_msg && session.common.encrypted.is_some() {
if let (Some(&msg_type), SessionKexState::InProgress(kex)) =
(pkt.buffer.first(), &session.kex)
{
if msg_type >= msg::USERAUTH_REQUEST {
// If the peer's KEXINIT was already received, reject non-transport packets
if kex.peer_kexinit_received() {
return Err(crate::Error::Inconsistent.into());
}
// Aggregate the length of the pending messages
session.pending_len =
session.pending_len.saturating_add(pkt.buffer.len() as u32);
// Disconnect if the size exceeds double the window size
if u64::from(session.pending_len)
> 2 * u64::from(session.common.config.window_size)
{
return Err(crate::Error::Pending.into());
}
}
}
}The implementation tracks whether the peer's KEXINIT has been received using peer_kexinit_received(). If it has, any non-transport packet is immediately identified as a protocol violation and rejected. If the peer's packet has not yet arrived (meaning the rekey was initiated by the local host), the incoming packets are buffered, but their cumulative size is strictly limited to twice the configured window_size to prevent unbounded heap allocation.
To execute the denial of service attack, an adversary must possess valid authentication credentials to establish a session with the target SSH server. The exploit sequence proceeds as follows.
First, the client establishes an encrypted session and completes authentication. Second, the client sends an SSH_MSG_KEXINIT packet to trigger a key rekeying process. The server transitions its internal state to InProgress and responds with its own negotiation parameters.
Third, the client deliberately stalls the key exchange by withholding the required key agreement initiation messages (such as SSH_MSG_KEX_ECDH_INIT). Fourth, the client streams a high-frequency sequence of SSH_MSG_CHANNEL_OPEN packets. The server generates response packets for each channel request, storing them indefinitely on the heap. This flow persists until the system kernel terminates the process due to physical or virtual memory exhaustion.
The security impact of CVE-2026-102821 is classified as a high-impact Denial of Service (DoS). The vulnerability allows any authenticated user, regardless of their privilege level, to terminate the SSH server daemon. This affects not only the attacker's session but also all other active sessions and services relying on the russh instance.
The vulnerability is assigned a CVSS v3.1 score of 6.5 (Medium). The base metric reflects network accessibility, low attack complexity, and low required privileges. No user interaction is required, and the impact is confined strictly to availability.
In containerized environments, such as Kubernetes pods or Docker containers, a process crash caused by an Out-of-Memory (OOM) event may trigger container restarts, leading to broader service disruption. In standalone deployments without automatic service supervisors, the service remains offline until manual intervention is performed.
The definitive remediation for this vulnerability is upgrading the russh library dependency to version 0.63.2 or later. This version enforces the RFC-compliant packet-gating and size limit check.
To apply the update, modify the project's dependency manifest and update the cargo lockfile.
# Cargo.toml
[dependencies]
russh = "0.63.2"cargo update -p russhIf upgrading the library is not immediately possible, three network-level and configuration-level mitigations should be implemented. First, apply an inactivity timeout within the russh server configuration to close stagnant handshakes. Second, implement firewall-level rate limiting to restrict the volume of connection-layer packets from a single source. Third, configure system-level resource limits (such as ulimit or systemd memory limits) to isolate the impact of memory exhaustion on co-located services.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H| Product | Affected Versions | Fixed Version |
|---|---|---|
russh Eugeny | >= 0.58.0, < 0.63.2 | 0.63.2 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-400 |
| Attack Vector | Network (AV:N) |
| CVSS Score | 6.5 (Medium) |
| EPSS Score | 0.00295 |
| Exploit Status | No public functional exploit |
| KEV Status | Not listed in CISA KEV |
| Impact | Denial of Service (Memory Exhaustion / Crash) |
The product does not properly control the allocation and maintenance of a limited resource, enabling an actor to influence the amount of resources consumed.
CVE-2026-128087 (GHSA-9264-jvgf-6w2f) is an incorrect behavior order (CWE-696) and improper authorization (CWE-863) vulnerability in the russh Rust SSH library, affecting versions 0.55.0 through 0.65.0. During the initial SSH key exchange (KEX) handshake, the client state machine invokes the client::Handler::kex_done() callback—providing the negotiated raw shared secret bytes—prior to validating the remote server's host key or certificate via check_server_key(). Consequently, an untrusted or rogue SSH server can complete cryptographic key agreement and force a connecting client to execute side-effecting application logic inside kex_done() before the server's identity is checked and rejected.
CVE-2026-128082 (GHSA-6vhm-j9h7-f9gh) is an uncontrolled recursion vulnerability (CWE-674) in AutoMapper, a convention-based object-object mapper for .NET. When mapping nested or self-referential types into destination models that rely on parameterized constructors, C# positional records, or recursive ConstructUsing expressions, AutoMapper evaluates child constructor arguments prior to incrementing the parent's recursion depth counter. This ordering flaw bypasses both explicit MaxDepth limits and the default depth limit of 64. An unauthenticated remote attacker can supply deeply nested input payloads to affected endpoints, exhausting the thread call stack and triggering an uncatchable System.StackOverflowException that terminates the hosting .NET process.
An information exposure vulnerability in the @opentelemetry/instrumentation-http package for OpenTelemetry JavaScript versions 0.204.0 prior to 0.222.0 causes incoming HTTP server spans to record raw, unredacted query string parameters under the url.query attribute. While outgoing client spans applied built-in and user-configured query parameter redaction, incoming server spans bypassed this sanitization completely, resulting in the transmission of sensitive credentials such as pre-signed cloud URLs and API tokens to external observability backends.
CVE-2026-128089 is an uncontrolled resource consumption vulnerability in the dnspython toolkit for Python, affecting all versions prior to 2.9.2. When parsing Well-Known Service (WKS) records from text via dns.rdtypes.IN.WKS.WKS.from_text(), the parser fails to validate that numeric service port identifiers fall within the RFC 1035 valid range of 0 through 65535. An attacker capable of supplying untrusted zone files or RDATA text strings containing an arbitrarily large service port integer can force the parser to allocate an unbounded bitmap array using an inefficient linear append loop, resulting in severe CPU exhaustion, application hangs, or Out-Of-Memory (OOM) process termination.
CVE-2026-126347 (GHSA-5cjw-f85j-cv6r) is an open redirect vulnerability (CWE-601) in Tornado, an asynchronous Python networking library and web framework. The flaw resides in tornado.web.RedirectHandler when dynamic URL redirection templates incorporate unvalidated user input. Due to a parser differential between RFC 3986 (used by Python's urllib.parse.urlsplit) and the WHATWG URL Standard (used by modern web browsers), inputs containing three or more leading slashes bypass Tornado 6.6.0's validation logic, allowing unauthenticated attackers to redirect users to arbitrary external domains.
A Denial of Service (DoS) vulnerability exists in @sveltejs/adapter-node versions 5.5.7 and 6.0.0-next.0 through 6.0.0. When a SvelteKit server route returns a direct response from a fetch() call with a Content-Type of text/event-stream, the Node.js adapter attempts to mutate the response headers to disable proxy buffering. Because headers returned directly by the WHATWG Fetch API carry an immutable guard, this mutation throws an unhandled TypeError, terminating the underlying Node.js process and denying service to all active and subsequent clients.