fix(deps): update rust crate russh to v0.61.1 [security]#693
Open
renovate[bot] wants to merge 1 commit into
Open
fix(deps): update rust crate russh to v0.61.1 [security]#693renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #693 +/- ##
==========================================
+ Coverage 41.28% 47.56% +6.28%
==========================================
Files 16 25 +9
Lines 671 2075 +1404
==========================================
+ Hits 277 987 +710
- Misses 394 1088 +694 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
fc804b4 to
d6104df
Compare
d6104df to
c599b49
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
=0.60.3→=0.61.1russh: Post-decompression SSH packet size was not bounded, allowing remote oversized compressed packets
CVE-2026-46702 / GHSA-wwx6-x28x-8259
More information
Details
Summary
When SSH compression is enabled,
russhaccepted compressed packets whose on-wire size passed the normal transport packet-length checks but whose decompressed size was much larger. This allowed a remote peer to send oversized post-decompression packets that should have been rejected.In current releases, this is a remote denial-of-service / resource-exhaustion issue in the post-decompression receive path.
In older releases before
0.58.0, the same remote decompression path usedCryptoVec, which appears to make the historical impact worse.Details
The normal SSH transport read path enforces a packet-length limit before the packet body is read:
russh/src/cipher/mod.rsHowever, RFC 4253 compression is applied to the SSH
payloadfield only. Thepacket_lengthfield and MAC are computed over the compressed payload, so a packet that is reasonably sized on the wire can still expand to a much larger message body after decompression.In
russh, compressed packet bodies are later decompressed in:russh/src/compression.rsrussh/src/client/mod.rsrussh/src/server/session.rsBefore the fix,
Decompress::decompress()grew its output buffer by repeated doubling and did not enforce a separate post-decompression ceiling. That meant a peer could send a small compressed packet that passed the normal on-wire transport length checks and then inflate it into a much larger packet after decompression.It was verified that an attacker-crafted compressed payload can stay below the normal
256 KiBimplementation transport packet cap while still inflating above the intended post-decompression bound. In other words, this is not only a "large on-wire packet" issue.Version detail:
russhas far back as0.34.0.>= 0.34.0, < 0.58.0, the remote decompression path still usedCryptoVec. Remote compressed SSH traffic could drive that path, and under constrained memory that historical code path could abort the process.>= 0.58.0, non-secret packet/decompression buffers were moved offCryptoVecand ontoVec<u8>, but the post-decompression size still remained unbounded. So the bug class remained reachable remotely, but the maintained-line impact is a current remote DoS / oversized-packet-acceptance issue rather than the olderCryptoVec-based abort story.0.60.2.Compression is not selected in a default-vs-default
russhsession because the default preference order putsnonefirst. However, the default server configuration still advertiseszlibandzlib@openssh.com, and server-side negotiation follows the client's preference order for common algorithms. A client that prefers compression can therefore negotiate it with a defaultrusshserver.OpenSSH portable was checked at
/home/mjc/projects/openssh-portablecommit45b30e0a5. OpenSSH enforces a256 KiBtransport packet cap before decompression, but it does not reuse that cap after decompression. Instead, decompression writes to ansshbuf, which is indirectly bounded by OpenSSH'sSSHBUF_SIZE_MAXhard maximum of0x8000000bytes (128 MiB).The patch direction should follow that model: add an explicit post-decompression ceiling of
128 MiB, rather than assuming the compressed transport packet cap also bounds decompressed payload size.Relevant OpenSSH reference points:
/home/mjc/projects/openssh-portable/packet.c:PACKET_MAX_SIZE (256 * 1024)/home/mjc/projects/openssh-portable/packet.c:uncompress_buffer()inflates intocompression_buffer/home/mjc/projects/openssh-portable/sshbuf.h:SSHBUF_SIZE_MAX 0x8000000RFC / OpenSSH Comparison
RFC 4253 section 6 defines the binary packet format:
packet_lengthpadding_lengthpayloadRFC 4253 section 6.2 says that, when compression is negotiated, the
payloadfield is compressed, and thatpacket_lengthand MAC are computed from the compressed payload. The RFC also says implementations should check that packet length is reasonable to avoid denial-of-service and buffer-overflow attacks.That means the pre-decompression transport packet length check is necessary but not sufficient. A correct implementation still needs a reasonable bound on the decompressed payload that becomes parser input.
OpenSSH provides such a bound indirectly through
sshbuf's hard maximum. Therusshfix should make the corresponding post-decompression bound explicit.PoC
There were two kinds of proof:
DEBUGpayload can stay below the normal SSH transport packet cap while still inflating beyond the intended post-decompression boundThe current in-tree regression tests are:
tests::compress::oversized_debug_payload_can_stay_below_wire_capcompression::tests::oversized_decompressed_packet_is_rejectedclient::tests::compressed_debug_is_ignored_after_client_parses_itclient::tests::oversized_compressed_debug_is_rejected_before_client_ignores_itserver::session::tests::compressed_debug_is_ignored_after_server_parses_itserver::session::tests::oversized_compressed_debug_is_rejected_before_server_ignores_itThe important behavior is:
DEBUGpayload can stay below the normal256 KiBtransport packet cap while still inflating beyond128 MiB.DEBUGpackets are still ignored normally after parsing.DEBUGpackets are rejected before the implementation reaches the normal "ignore DEBUG" behavior.The strongest PoC for severity is the unauthenticated server-side case. A malicious client can choose
zlibin the initial key exchange, because the default server advertises it and server-side negotiation follows the client's preference order for common algorithms. AfterNEWKEYS, but before authentication, the client can send a transport-layerSSH_MSG_DEBUGpacket whose compressed body is below the transport packet cap but whose decompressed body exceeds the post-decompression cap.That demonstrates the
AV:N/AC:L/PR:N/UI:Ncase directly: the attacker is a remote SSH client and does not need a successfully authenticated session.The equivalent wire-level attack shape is:
The direct receive-path client/server regression tests are still useful because they isolate the bug precisely. They construct the post-decryption compressed packet body passed to
maybe_decompress()and prove that the oversized packet is rejected before normalDEBUGignore handling. The server-side pre-auth variant above is the one that justifies the highest CVSS framing for this bug.The most important targeted checks are:
Before the fix, both the direct client and direct server receive-path oversized checks went red because the compressed payload was accepted and decompressed instead of being rejected at the post-decompression boundary. After the fix, they pass.
Impact
Suggested CVSS v3.1 for current maintained releases:
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H7.5Reasoning:
AV:N: reachable by a remote SSH peerAC:L: straightforward once compression is enabledPR:N,UI:N: no prior auth or user interaction requiredC:N,I:N: confidentiality or integrity impact was not demonstratedA:H: remote peer can cause oversized post-decompression packet processing and disconnect / denial of serviceAffected versions:
russh >= 0.34.0, < 0.58.0russh >= 0.58.0, including0.60.3Fix / Patch Direction
Add an explicit maximum decompressed SSH packet size and enforce it inside
Decompress::decompress()before returning decompressed bytes to the client or server packet parser.The intended ceiling is
128 MiB, matching OpenSSH portable's effectivesshbufhard maximum for post-decompression packet storage. The fix should reject decompression output larger than that bound with a packet-size error before normal message dispatch.The fix should preserve normal compressed packet behavior below the cap, including
DEBUGpackets that are decompressed and then ignored through the existing normal path.Patch branch:
Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:HReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
russh server userauth state is not reset when authentication principal changes
CVE-2026-46705 / GHSA-hpv4-5h6f-wqr3
More information
Details
Summary
The
russhserver authentication path keeps internal userauth state acrossSSH_MSG_USERAUTH_REQUESTmessages without separating that state when the request principal changes.RFC 4252 allows the
user nameandservice namefields to change between authentication requests. The issue is not that such changes are invalid. The issue is that russh-owned authentication state, such as remaining methods, partial-success state, and in-progress method state, can remain associated with the connection and then influence a later request for a different(user, service).This is an internal library state mismatch. Applications are responsible for any authentication state they keep in their own handlers, but russh must reset or separate state that russh itself owns.
Details
The relevant server-side auth logic is in:
russh/src/server/encrypted.rsrussh/src/auth.rsRFC 4252 section 5 says the
user nameandservice namefields are repeated in everySSH_MSG_USERAUTH_REQUESTand may change. It also says the server implementation must check those fields in every message and flush accumulated authentication state if they change; if it cannot flush that state, it must disconnect.In vulnerable
russhcode, the username and service are decoded from eachSSH_MSG_USERAUTH_REQUEST, while theAuthRequeststate remains connection-scoped. That state includes:methods, which is later encoded as theSSH_MSG_USERAUTH_FAILUREremaining-methods list.partial_success, which is later encoded inSSH_MSG_USERAUTH_FAILURE.current, which tracks in-progress method state such as public-key offer or keyboard-interactive challenge state.rejection_count.If one request narrows russh's internal
methodsset, a later request for a different user can observe that narrowed set unless the internal state is reset at the principal boundary.PoC
The PoC demonstrates only russh-owned state. The handler does not store any cross-request state. Alice's request narrows russh's remaining methods to
password; Bob's later plain reject should not reuse that internal state.On
upstream/main, this fails with:That failure is produced by russh's retained
AuthRequest.methods; it does not depend on handler-owned MFA/session state.Impact
Suggested provisional CVSS v3.1:
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N5.3Reasoning:
AV:N: reachable by a remote SSH client during authentication.AC:L: the attack is a normal sequence of SSH user-auth packets.PR:N: the attacker does not need an already-authenticated SSH session.UI:N: no user interaction is required on the server side.S:U: the impact is within the vulnerable SSH server implementation.C:N: the narrow PoC does not disclose confidential data.I:L: russh-owned authentication state for one principal can affect the authentication flow for a different principal.A:N: the narrow PoC does not demonstrate an availability impact.This report does not claim that username changes are inherently invalid, nor does it rely on application-owned authentication state being mishandled by the embedding server.
Fix / Patch Direction
The fix should update russh's internal userauth state handling so that accumulated russh-owned state is flushed or separated when
(user, service)changes betweenSSH_MSG_USERAUTH_REQUESTmessages.The fix stores the last seen
(user, service)onAuthRequest. When a new auth request arrives for a different principal, russh resets its internal auth state before dispatching the new request. This keeps username changes protocol-valid while preventing prior russh-owned auth state from carrying into the new principal.Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Release Notes
warp-tech/russh (russh)
v0.61.1Compare Source
Security fixes
GHSA-wwx6-x28x-8259
When compression is negotiated, an attacker can craft a "ZIP bomb" style packet that would bypass the maximum packet size checks. This could allow the attacker to hit the OOM limit and either get the server process killed by the OS, or, prior to russh@0.58.0, aborted. A similar issue existed in the AgentClient as well, which could be triggered by a malformed SSH agent response.
Fixes
v0.61.0Compare Source
Changes
32fd46f: Reduce russh write-path copies with direct Bytes sends (#695) (Mika Cohen) #695Channel::data_bytesChannel::extended_data_bytesChannelWriteHalf::data_bytesChannelWriteHalf::extended_data_bytesdeps: migrate to stable versions pkcs5 / pkcs8 /
ed25519and loosen prerelease pins (extends #697) (#702) #702 (escapecode)72b250a: migrate to upstreamssh-keycrate and update RustCrypto crates (#709) (Eugene) #709Security fixes
Part of the hardening efforts by @mjc
GHSA-hpv4-5h6f-wqr3
russhserver implementation would not correctly reset its internal state (allowed methods and "partial success" state), which could lead to incorrect responses to the client.GHSA-g9g7-5cgw-6v28
keyboard-interactiveauthentication request, the prompt counter was used to directly allocate memory without verifying it, which can lead to denial of service.GHSA-76r6-x97p-67vr
russhserver did not enfore the SSH protocol header validation strictly enough, allowing a client to hold the connection open indefinitely, wasting resources.GHSA-4r3c-5hpg-58qr
Fixes
4186cf2: Refactor block-cipher packet-length probing to avoid unsafe state duplication (#706) (Mika Cohen) #706Configuration
📅 Schedule: (UTC)
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.