CVE-2026-105660: Unvalidated HTTP/1 request-target authority lets a client choose conn.host and conn.port in Bandit
Improper Validation of Syntactic Correctness of Input vulnerability in mtrudel bandit allows an unauthenticated remote attacker to set conn.host and conn.port to values outside the RFC 3986 host grammar via the authority of an HTTP/1 absolute-form or authority-form request target. Bandit validates the Host header and answers 400 when it is malformed, but when the request target carries its own authority that authority takes precedence, as RFC 9112 requires, and Bandit.Pipeline.determinehostandport!/4 in lib/bandit/pipeline.ex passes it to the application unchecked. A request line such as GET http://good.example@evil.example/x HTTP/1.1 with a valid Host header yields a conn.host of good.example@evil.example, and the same path admits NUL, DEL and non-ASCII bytes, invalid IP literals and ports outside 1..65535. The HTTP/1.0 clause needs no Host header at all, and CONNECT places the unparsed port string in conn.port.
Applications that build absolute URLs from conn.host, such as through Plug.Conn.requesturl/1 or Phoenix URL helpers, emit links whose authority the attacker chose. Message framing is unaffected, and no CR or LF can reach conn.host.
This issue affects bandit: from 0.6.0 before 1.13.0.
Affected Software
Event History
Frequently Asked Questions
Which applications are most exposed to this issue?
Applications that use conn.host to construct absolute URLs are exposed to attacker-controlled authorities in generated links. This includes use through Plug.Conn.request_url/1 or Phoenix URL helpers.
What does an attacker need to exploit it?
An unauthenticated remote attacker needs to send an HTTP/1 request using an absolute-form or authority-form request target containing a chosen authority. HTTP/1.0 requests do not require a Host header, while a valid Host header can accompany HTTP/1.1 requests.
Can a valid Host header prevent the attacker-controlled host from being used?
No. When the request target includes its own authority, that authority takes precedence over the Host header, and the authority is passed to the application without validation.
Are HTTP message framing or header injection affected?
Message framing is unaffected. CR and LF cannot reach conn.host, although the unchecked authority can include values outside the RFC 3986 host grammar, including NUL, DEL, non-ASCII bytes, invalid IP literals, and invalid ports.