Update Rust crate russh to 0.44.0 [SECURITY] #6335
Merged
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.43.0
->0.44.0
GitHub Vulnerability Alerts
GHSA-vgvv-x7xg-6cqg
Summary
Allocating an untrusted amount of memory allows any unauthenticated user to OOM a russh server.
Details
An SSH packet consists of a 4-byte big-endian length, followed by a byte stream of this length.
After parsing and potentially decrypting the 4-byte length, russh allocates enough memory for this bytestream, as a performance optimization to avoid reallocations later.
https://github.com/Eugeny/russh/blob/4eaa080e7532662023f75e8fff45b743fe607f8c/russh/src/cipher/mod.rs#L254
But this length is entirely untrusted and can be set to any value by the client, causing this much memory to be allocated, which will cause the process to OOM within a few such requests.
RFC 4253 contains an explicit section on packet length limits: https://datatracker.ietf.org/doc/html/rfc4253#section-6.1
PoC
Running the
echoserver
example on port 2222 (cd russh && cargo run --release --example echoserver
), the provided Rust program can be executed against this echoserver and will cause it to OOM within a few tries.Rust code to run against the echo server
Cargo.toml
main.rs
Impact
Due to this allocation, a russh server can be brought to OOM, causing a DoS.
Since this happens before authentication, it can be done by any user that has access to the TCP port over the internet.
Release Notes
warp-tech/russh (russh)
v0.44.1
Compare Source
Security fixes
GHSA-vgvv-x7xg-6cqg - SSH OOM DoS through malicious packet length
It was possible for an attacker to cause Warpgate to allocate an arbitrary amount of memory by sending a packet with a malformed length field, potentially causing the application to get killed due to excessive RAM usage.
v0.44.0
Compare Source
Breaking changes
OpenSSL-free RSA
openssl
feature to reduce your app size and improve portability and build speed.Preferred::DEFAULT
when theopenssl
feature is disabled.Preferred algorithms config changes -
77cc2f7
Preferred
are nowCow<&'static, [Name]>
instead of&'static [Name]
, allowing you to dynamically construct the lists. If you're using custom algorithm lists, you'll need to update your code:Preferred::compression
items is nowrussh::compression::Name
instead ofString
.Name
structs now implementTryFrom<&'static str>
which will validate that the named algorithm is actually implemented in the library.russh_keys::key::ALL_KEY_TYPES
,russh::kex::ALL_KEX_ALGORITHMS
,russh::cipher::ALL_CIPHERS
,russh::compression::ALL_COMPRESSION_ALGORITHMS
andrussh::mac::ALL_MAC_ALGORITHMS
.Incorrect
Ed25519
PKCS#8 key savingv0.43
,russh-keys
has generated incorrect key format when savingEd25519
keys in PKCS#8 format. This is fixed inv0.44
but by default,v0.44
will fail to parse keys generated inv0.43
.v0.44
to parse these keys, enable thelegacy-ed25519-pkcs8-parser
feature of therussh-keys
crate.Other changes
3bfd99f
:ecdh-sha2-nistp{256,384,521}
kex support (#282) (Michael Gleason) #282800969b
: Implement-cbc
ciphers. (#297) (Pierre Barre) #2971eaadfb
: Add support for glob pattern matching in Host directives (#306) (Adam Chappell) #30688196a7
: allow convertingChannelId
intou32
Fixes
643be05
: Fix block ciphers + HMAC_SHA1_ETM (#298) (Pierre Barre) #2982bfe426
: Fix hardcoded public key auth negotiation (#294) (Tom König) #2949cce48c
: Allow ssh-rsa keys to be used for rsa-sha2-* auth (#290) (Ana Gelez) #2909e1ed09
: Overachiever host key checking (#302) (Jean-Baptiste Skutnik) #3023f4646a
: removed use of unstable Option::inspectf2d94c0
: fixed Eugeny/warpgate#996 - prevent offering of unparseable public keys from ending the sessionConfiguration
📅 Schedule: Branch creation - "" in timezone America/Los_Angeles, Automerge - "after 8pm,before 6am" in timezone America/Los_Angeles.
🚦 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.
This PR has been generated by Renovate Bot.