mirror of
https://github.com/amnezia-vpn/amnezia-xray-core.git
synced 2026-10-13 21:33:49 +00:00
[GH-ISSUE #23] httpupgrade inbound: no read deadline or header size limit enables pre-auth DoS #2
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
amnezia-vpn/amnezia-xray-core#2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @FrogRocky on GitHub (Aug 17, 2026).
Original GitHub issue: https://github.com/amnezia-vpn/amnezia-xray-core/issues/23
Summary
The httpupgrade inbound handler reads the upgrade request with no read deadline and no header size limit, allowing unauthenticated resource exhaustion on any open httpupgrade listener.
Affected code:
transport/internet/httpupgrade/hub.go(upgrade(), the per-connection goroutine):Impact
Two pre-authentication DoS vectors, before any proxy protocol or credential is seen:
http.ReadRequest(unlikehttp.Server) does not applyMaxHeaderBytes;textprotogrows the line buffer without bound. A single connection sendingGET / HTTP/1.1\r\nX-P:followed by a multi-GB header value without a terminator buffers the whole thing in memory → OOM.Sibling transports already handle this — the websocket hub sets
ReadHeaderTimeout: 4sandMaxHeaderBytes: 8192, and the splithttp hub setsReadHeaderTimeout: 4s. httpupgrade has neither.Suggested fix
In the connection goroutine, before
http.ReadRequest:conn.SetReadDeadline(time.Now().Add(4 * time.Second))(and clear it after the 101 response is written), andwebsocket/hub.go.