
Cloud Vulnerability DB
A community-led vulnerabilities database
With the default http2 feature, HttpServer::bind() / listen() serve plaintext connections through tcp_auto_h2c(), which awaits io.peek() to pick HTTP/1 or HTTP/2 (actix-http/src/service.rs#L231-L261). That peek has no deadline, and the client request timeout (5 seconds by default) only starts once the H1 dispatcher exists. A peer that connects and sends nothing is never closed.
Any client that can open TCP connections to a plaintext listener. Auto-h2c has been the default for plaintext binds since 4.19.0 (#4400). TLS listeners, .auto_h2c(false), builds without http2, and services behind an L7 proxy that waits for a full request before connecting upstream don't hit this path. This is separate from GHSA-54pm-2wm5-hpmg, which is about a partial second request inside the dispatcher. This happens before any dispatcher is built.
I used a stock app (HttpServer::new(|| App::new().service(greet)).bind("127.0.0.1:...")?.run()) built from source at 0581ada (actix-web 4.20.0 / actix-http 3.22.0) and again at current main (12df9de), with the server's soft fd limit at 1,024. The client opened 1,100 connections that send nothing, waited 10 seconds, then sent one normal request on a new connection.
| Case | Silent sockets after 10 s | 408 sent | Normal request |
|---|---|---|---|
| Default (auto-h2c on) | 1,100 still open | 0 | no response (timed out) |
.auto_h2c(false) control | 0 | 1,100 | HTTP 200 |
| Default with the patch below | 0 (all closed) | 0 | HTTP 200 |
| Same results on both commits. |
The patch below bounds the peek with client_request_deadline() and closes the connection when it expires. A zero (disabled) client request timeout keeps the current unbounded behavior. With the patch, cargo test -p actix-http and cargo test -p actix-web pass. One behavior change: a silent connection is closed without a 408 response, since nothing has been parsed yet.
I can share the local harnesses as regression tests if useful.
Reported by Dickson Wu (SEAL & CertiK).
From 53e165797c01d5e4c636cd3bf01c5b2e051071f5 Mon Sep 17 00:00:00 2001
From: Dickson Wu <33645481+DicksonWu654@users.noreply.github.com>
Date: Tue, 24 Nov 2026 13:06:56 +0000
Subject: [PATCH] Bound auto-h2c detection by request timeout
Close silent plaintext connections when the configured client request timeout expires. Preserve unlimited peeking when the timeout is disabled.
---
actix-http/src/service.rs | 53 ++++++++++++++++++++++++---------------
1 file changed, 33 insertions(+), 20 deletions(-)
diff --git a/actix-http/src/service.rs b/actix-http/src/service.rs
index d91a8c72..e54a2123 100644
--- a/actix-http/src/service.rs
+++ b/actix-http/src/service.rs
@@ -15,6 +15,8 @@ use actix_service::{
use futures_core::{future::LocalBoxFuture, ready};
use pin_project_lite::pin_project;
use tokio::net::TcpStream;
+#[cfg(feature = "http2")]
+use tokio::time::timeout_at;
use tracing::error;
use crate::{
@@ -233,30 +235,41 @@ where
) -> impl ServiceFactory<TcpStream, Config = (), Response = (), Error = DispatchError, InitError = ()>
{
let tcp_nodelay = self.cfg.tcp_nodelay();
+ let config = self.cfg.clone();
+
+ fn_service(move |io: TcpStream| {
+ let deadline = config.client_request_deadline();
+
+ async move {
+ // subset of HTTP/2 preface defined by RFC 9113 §3.4
+ // this subset was chosen to maximize likelihood that peeking only once will allow us to
+ // reliably determine version or else it should fallback to h1 and fail quickly if data
+ // on the wire is junk
+ const H2_PREFACE: &[u8] = b"PRI * HTTP/2";
+
+ let mut buf = [0; 12];
+
+ if let Some(deadline) = deadline {
+ timeout_at(deadline.into(), io.peek(&mut buf))
+ .await
+ .map_err(|_| std::io::Error::from(std::io::ErrorKind::TimedOut))??;
+ } else {
+ io.peek(&mut buf).await?;
+ }
- fn_service(move |io: TcpStream| async move {
- // subset of HTTP/2 preface defined by RFC 9113 §3.4
- // this subset was chosen to maximize likelihood that peeking only once will allow us to
- // reliably determine version or else it should fallback to h1 and fail quickly if data
- // on the wire is junk
- const H2_PREFACE: &[u8] = b"PRI * HTTP/2";
-
- let mut buf = [0; 12];
-
- io.peek(&mut buf).await?;
+ let proto = if buf == H2_PREFACE {
+ Protocol::Http2
+ } else {
+ Protocol::Http1
+ };
- let proto = if buf == H2_PREFACE {
- Protocol::Http2
- } else {
- Protocol::Http1
- };
+ if let Some(nodelay) = desired_nodelay(tcp_nodelay) {
+ set_nodelay(&io, nodelay);
+ }
- if let Some(nodelay) = desired_nodelay(tcp_nodelay) {
- set_nodelay(&io, nodelay);
+ let peer_addr = io.peer_addr().ok();
+ Ok((io, proto, peer_addr))
}
-
- let peer_addr = io.peer_addr().ok();
- Ok((io, proto, peer_addr))
})
.and_then(self)
}
--
2.43.0Source: NVD
Free Vulnerability Assessment
Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.
Get a personalized demo
"Best User Experience I have ever seen, provides full visibility to cloud workloads."
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
"We know that if Wiz identifies something as critical, it actually is."