Skip to content

fix(deps): update rust crate russh to 0.60 [security]#937

Open
renovate[bot] wants to merge 1 commit intomainfrom
renovate/crate-russh-vulnerability
Open

fix(deps): update rust crate russh to 0.60 [security]#937
renovate[bot] wants to merge 1 commit intomainfrom
renovate/crate-russh-vulnerability

Conversation

@renovate
Copy link
Copy Markdown
Contributor

@renovate renovate Bot commented Apr 24, 2026

This PR contains the following updates:

Package Type Update Change
russh dependencies minor 0.570.60

Warning

Some dependencies could not be looked up. Check the Dependency Dashboard for more information.


russh has pre-auth DoS via unbounded allocation in its keyboard-interactive auth handler

GHSA-f5v4-2wr6-hqmg

More information

Details

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
  1. Attacker connects via TCP, completes key exchange (no credentials needed -- this is the anonymous DH handshake, not authentication)
  2. Sends USERAUTH_REQUEST with method keyboard-interactive
  3. Server handler returns Auth::Partial with prompts (standard for 2FA/TOTP)
  4. Attacker sends USERAUTH_INFO_RESPONSE with n = 0x10000000 and no response data
  5. 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::Partial for 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.

Severity

  • CVSS Score: 7.5 / 10 (High)
  • Vector String: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Release Notes

warp-tech/russh (russh)

v0.60.1

Compare Source

Security fixes

GHSA-f5v4-2wr6-hqmg in 6c3c80a

This DoS vulnerability allowed an unauthenticated user to trigger an out-of-memory condition in a russh based server if keyboard-interactive authentication is allowed. A malicious authentication packet could trigger a multi-GB memory allocation likely leading to the process getting killed by the OOM killer.

Fixes

v0.60.0

Compare Source

Changes

Fixes

v0.59.0

Changes

Fixes

Misc

v0.58.0

Compare Source

Changes

  • eliminate mlock/munlock overhead for non-secret buffers (~21% throughput improvement) (#​653) #​653 (Mika Cohen)

    • Non-sensitive data buffers are no longer wrapped in CryptoVec, reducing the performance overhead. A few public functions that took CryptoVec now take impl Into<Bytes> instead.
  • 6f70150: Remove heap allocations from SshId (#​656) (kpcyrd) #​656

    • SshId::Standard() now contains a Cow<'static, str> instead of a String.
  • 0f51860: Expose HostConfig fields to external consumers (#​652) (François Bernier) #​652

  • e75de5a: Add russh/serde feature to enable serde on russh::keys::PublicKey (#​655) (kpcyrd) #​655

  • replace memset with zeroize in resize() method (#​634) #​634 (Eric Rodrigues Pires)

  • bump thiserror to latest version (#​651) #​651 (Roger Knecht)

  • b7ce487: Remove Home Crate Dependency (#​667) (Roger Knecht) #​667

  • bebe8c0: fixed #​658 - make Handle::tcpip_forward and Handle::streamlocal_forward take &self (Eugene)

Fixes

v0.57.1

Compare Source

Fixes

Features


Configuration

📅 Schedule: (UTC)

  • Branch creation
    • ""
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate Bot changed the title fix(deps): update rust crate russh to 0.60 [security] fix(deps): update rust crate russh to 0.60 [security] - autoclosed Apr 27, 2026
@renovate renovate Bot closed this Apr 27, 2026
@renovate renovate Bot deleted the renovate/crate-russh-vulnerability branch April 27, 2026 19:35
@renovate renovate Bot changed the title fix(deps): update rust crate russh to 0.60 [security] - autoclosed fix(deps): update rust crate russh to 0.60 [security] Apr 27, 2026
@renovate renovate Bot reopened this Apr 27, 2026
@renovate renovate Bot force-pushed the renovate/crate-russh-vulnerability branch 2 times, most recently from 94a6f59 to 4535f34 Compare April 27, 2026 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants