{"containers":{"cna":{"affected":[{"collectionURL":"https://repo.hex.pm","cpes":["cpe:2.3:a:mtrudel:bandit:*:*:*:*:*:*:*:*"],"defaultStatus":"unaffected","modules":["'Elixir.Bandit.Pipeline'","'Elixir.Bandit.HTTPTransport.Bandit.HTTP1.Socket'"],"packageName":"bandit","packageURL":"pkg:hex/bandit","product":"bandit","programFiles":["lib/bandit/pipeline.ex","lib/bandit/http1/socket.ex"],"programRoutines":[{"name":"'Elixir.Bandit.Pipeline':determine_host_and_port!/4"},{"name":"'Elixir.Bandit.Pipeline':build_conn!/6"},{"name":"'Elixir.Bandit.HTTPTransport.Bandit.HTTP1.Socket':resolve_request_target!/2"},{"name":"'Elixir.Bandit.HTTPTransport.Bandit.HTTP1.Socket':validate_request_line!/2"}],"repo":"https://github.com/mtrudel/bandit","vendor":"mtrudel","versions":[{"lessThan":"1.13.0","status":"affected","version":"0.6.0","versionType":"semver"}]},{"collectionURL":"https://github.com","cpes":["cpe:2.3:a:mtrudel:bandit:*:*:*:*:*:*:*:*"],"defaultStatus":"unaffected","modules":["'Elixir.Bandit.Pipeline'","'Elixir.Bandit.HTTPTransport.Bandit.HTTP1.Socket'"],"packageName":"mtrudel/bandit","packageURL":"pkg:github/mtrudel/bandit","product":"bandit","programFiles":["lib/bandit/pipeline.ex","lib/bandit/http1/socket.ex"],"programRoutines":[{"name":"'Elixir.Bandit.Pipeline':determine_host_and_port!/4"},{"name":"'Elixir.Bandit.Pipeline':build_conn!/6"},{"name":"'Elixir.Bandit.HTTPTransport.Bandit.HTTP1.Socket':resolve_request_target!/2"},{"name":"'Elixir.Bandit.HTTPTransport.Bandit.HTTP1.Socket':validate_request_line!/2"}],"repo":"https://github.com/mtrudel/bandit","vendor":"mtrudel","versions":[{"lessThan":"6ea80210137b3f69caf65f67398934259dc365d0","status":"affected","version":"0e3edda0edf6322e9164b827c6d3ddecd080ff2e","versionType":"git"}]}],"cpeApplicability":[{"nodes":[{"cpeMatch":[{"criteria":"cpe:2.3:a:mtrudel:bandit:*:*:*:*:*:*:*:*","versionEndExcluding":"1.13.0","versionStartIncluding":"0.6.0","vulnerable":true}],"negate":false,"operator":"OR"}],"operator":"AND"}],"credits":[{"lang":"en","type":"remediation developer","value":"Mat Trudel"},{"lang":"en","type":"coordinator","value":"Jonatan Männchen / EEF"},{"lang":"en","type":"finder","value":"Eurico Nicacio"},{"lang":"en","type":"reporter","value":"Eurico Nicacio"}],"dateAssigned":"2026-10-14T21:42:16.000Z","descriptions":[{"lang":"en","supportingMedia":[{"base64":false,"type":"text/html","value":"<p>Improper Validation of Syntactic Correctness of Input vulnerability in mtrudel bandit allows an unauthenticated remote attacker to set <code>conn.host</code> and <code>conn.port</code> 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 <code>Host</code> 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 <code>Bandit.Pipeline.determine_host_and_port!/4</code> in <code>lib/bandit/pipeline.ex</code> passes it to the application unchecked. A request line such as <code>GET http://good.example@evil.example/x HTTP/1.1</code> with a valid <code>Host</code> header yields a <code>conn.host</code> of <code>good.example@evil.example</code>, 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 <code>Host</code> header at all, and <code>CONNECT</code> places the unparsed port string in <code>conn.port</code>.</p>\n<p>Applications that build absolute URLs from <code>conn.host</code>, such as through <code>Plug.Conn.request_url/1</code> or Phoenix URL helpers, emit links whose authority the attacker chose. Message framing is unaffected, and no CR or LF can reach <code>conn.host</code>.</p>\n<p>This issue affects bandit: from 0.6.0 before 1.13.0.</p>"},{"base64":false,"type":"text/markdown","value":"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.determine_host_and_port!/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`.\n\nApplications that build absolute URLs from `conn.host`, such as through `Plug.Conn.request_url/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`.\n\nThis issue affects bandit: from 0.6.0 before 1.13.0."}],"value":"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.determine_host_and_port!/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.\n\nApplications that build absolute URLs from conn.host, such as through Plug.Conn.request_url/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.\n\nThis issue affects bandit: from 0.6.0 before 1.13.0."}],"impacts":[{"capecId":"CAPEC-220","descriptions":[{"lang":"en","supportingMedia":[{"base64":false,"type":"text/html","value":"<p>An unauthenticated client can make the application see any host string and any port number as the request's authority, bypassing the validation applied to the <code>Host</code> header. An application that builds absolute URLs from <code>conn.host</code>, such as password-reset or verification links, emits links whose host the attacker chose.</p>"},{"base64":false,"type":"text/markdown","value":"An unauthenticated client can make the application see any host string and any port number as the request's authority, bypassing the validation applied to the `Host` header. An application that builds absolute URLs from `conn.host`, such as password-reset or verification links, emits links whose host the attacker chose."}],"value":"An unauthenticated client can make the application see any host string and any port number as the request's authority, bypassing the validation applied to the Host header. An application that builds absolute URLs from conn.host, such as password-reset or verification links, emits links whose host the attacker chose."}]}],"metrics":[{"cvssV4_0":{"Automatable":"NOT_DEFINED","Recovery":"NOT_DEFINED","Safety":"NOT_DEFINED","attackComplexity":"LOW","attackRequirements":"NONE","attackVector":"NETWORK","baseScore":6.9,"baseSeverity":"MEDIUM","privilegesRequired":"NONE","providerUrgency":"NOT_DEFINED","subAvailabilityImpact":"NONE","subConfidentialityImpact":"NONE","subIntegrityImpact":"NONE","userInteraction":"NONE","valueDensity":"NOT_DEFINED","vectorString":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N","version":"4.0","vulnAvailabilityImpact":"NONE","vulnConfidentialityImpact":"NONE","vulnIntegrityImpact":"LOW","vulnerabilityResponseEffort":"NOT_DEFINED"},"format":"CVSS","scenarios":[{"lang":"en","value":"GENERAL"}]}],"problemTypes":[{"descriptions":[{"cweId":"CWE-1286","description":"CWE-1286 Improper Validation of Syntactic Correctness of Input","lang":"en","type":"CWE"}]}],"providerMetadata":{"dateUpdated":"2026-10-15T18:37:02.485Z","orgId":"6b3ad84c-e1a6-4bf7-a703-f496b71e49db","shortName":"EEF"},"references":[{"name":"GitHub Advisory","tags":["related","vendor-advisory"],"url":"https://github.com/mtrudel/bandit/security/advisories/GHSA-v53v-9hvg-37jf"},{"name":"EEF CNA record for CVE-2026-105660","tags":["related"],"url":"https://cna.erlef.org/cves/CVE-2026-105660.html"},{"name":"OSV record EEF-CVE-2026-105660","tags":["related"],"url":"https://osv.dev/vulnerability/EEF-CVE-2026-105660"},{"name":"Introducing commit 0e3edda in mtrudel/bandit","tags":["related"],"url":"https://github.com/mtrudel/bandit/commit/0e3edda0edf6322e9164b827c6d3ddecd080ff2e"},{"name":"Fix commit 6ea8021 in mtrudel/bandit","tags":["patch"],"url":"https://github.com/mtrudel/bandit/commit/6ea80210137b3f69caf65f67398934259dc365d0"}],"source":{"discovery":"EXTERNAL"},"title":"Unvalidated HTTP/1 request-target authority lets a client choose conn.host and conn.port in Bandit","workarounds":[{"lang":"en","supportingMedia":[{"base64":false,"type":"text/html","value":"<p>Add a plug ahead of any code that reads <code>conn.host</code> or <code>conn.port</code> that compares <code>conn.host</code> against an allow-list of the hostnames the application serves, checks that <code>conn.port</code> is an integer, and halts the request with a 400 response otherwise. Do not derive absolute URLs from <code>conn.host</code> until that check has passed.</p>"},{"base64":false,"type":"text/markdown","value":"Add a plug ahead of any code that reads `conn.host` or `conn.port` that compares `conn.host` against an allow-list of the hostnames the application serves, checks that `conn.port` is an integer, and halts the request with a 400 response otherwise. Do not derive absolute URLs from `conn.host` until that check has passed."}],"value":"Add a plug ahead of any code that reads conn.host or conn.port that compares conn.host against an allow-list of the hostnames the application serves, checks that conn.port is an integer, and halts the request with a 400 response otherwise. Do not derive absolute URLs from conn.host until that check has passed."}],"x_proofOfConcept":[{"lang":"en","supportingMedia":[{"base64":false,"type":"text/html","value":"<ol>\n<li>Start Bandit over plaintext HTTP with a plug that returns <code>conn.host</code> and <code>conn.port</code>.</li>\n<li>Open a raw TCP connection to the listener and send <code>GET http://good.example@evil.example/x HTTP/1.1</code> followed by <code>Host: good.example</code> and an empty line. The response is 200 and <code>conn.host</code> is <code>good.example@evil.example</code>.</li>\n<li>Repeat with <code>GET http://ex\\x00am.com/x HTTP/1.1</code> (a NUL byte in the authority) or <code>GET http://ex.com:99999/x HTTP/1.1</code>. Both are accepted, with the NUL byte in <code>conn.host</code> and 99999 in <code>conn.port</code>.</li>\n<li>Send the same bytes in the <code>Host</code> header of an origin-form request instead. Bandit answers 400 for the NUL byte and the out-of-range port on 1.12.5, and for every payload once the <code>Host</code> grammar tightening on main is released.</li>\n<li>Send <code>GET http://good.example@evil.example/x HTTP/1.0</code> with no <code>Host</code> header, or <code>CONNECT good.example@evil.example:443 HTTP/1.1</code>. Both are accepted, and the <code>CONNECT</code> form leaves <code>conn.port</code> as the binary <code>\"443\"</code>.</li>\n</ol>"},{"base64":false,"type":"text/markdown","value":"1. Start Bandit over plaintext HTTP with a plug that returns `conn.host` and `conn.port`.\n2. Open a raw TCP connection to the listener and send `GET http://good.example@evil.example/x HTTP/1.1` followed by `Host: good.example` and an empty line. The response is 200 and `conn.host` is `good.example@evil.example`.\n3. Repeat with `GET http://ex\\x00am.com/x HTTP/1.1` (a NUL byte in the authority) or `GET http://ex.com:99999/x HTTP/1.1`. Both are accepted, with the NUL byte in `conn.host` and 99999 in `conn.port`.\n4. Send the same bytes in the `Host` header of an origin-form request instead. Bandit answers 400 for the NUL byte and the out-of-range port on 1.12.5, and for every payload once the `Host` grammar tightening on main is released.\n5. Send `GET http://good.example@evil.example/x HTTP/1.0` with no `Host` header, or `CONNECT good.example@evil.example:443 HTTP/1.1`. Both are accepted, and the `CONNECT` form leaves `conn.port` as the binary `\"443\"`."}],"value":"* Start Bandit over plaintext HTTP with a plug that returns conn.host and conn.port.\n* Open a raw TCP connection to the listener and send GET http://good.example@evil.example/x HTTP/1.1 followed by Host: good.example and an empty line. The response is 200 and conn.host is good.example@evil.example.\n* Repeat with GET http://ex\\x00am.com/x HTTP/1.1 (a NUL byte in the authority) or GET http://ex.com:99999/x HTTP/1.1. Both are accepted, with the NUL byte in conn.host and 99999 in conn.port.\n* Send the same bytes in the Host header of an origin-form request instead. Bandit answers 400 for the NUL byte and the out-of-range port on 1.12.5, and for every payload once the Host grammar tightening on main is released.\n* Send GET http://good.example@evil.example/x HTTP/1.0 with no Host header, or CONNECT good.example@evil.example:443 HTTP/1.1. Both are accepted, and the CONNECT form leaves conn.port as the binary \"443\"."}],"x_technicalAnalysis":[{"lang":"en","supportingMedia":[{"base64":false,"type":"text/html","value":"<p><strong>1. Request-target parsing</strong> (<code>lib/bandit/http1/socket.ex</code>)</p>\n<p><code>:erlang.decode_packet/3</code> returns an absolute-form target as <code>{:absoluteURI, scheme, host, port, path}</code> and an authority-form (<code>CONNECT</code>) target as <code>{:scheme, host, port}</code>. <code>resolve_request_target!/2</code> unwraps both into a <code>{scheme, host, port, path}</code> tuple and forwards <code>host</code> and <code>port</code> as received. <code>validate_request_line!/2</code> only rejects bytes at or below <code>0x20</code> and <code>0x7F</code>, so userinfo, delimiters, backslashes, bytes <code>0x80</code> to <code>0xFF</code>, invalid IP literals and out-of-range ports pass. For <code>CONNECT</code>, <code>port</code> is the unparsed text after the first colon.</p>\n<p><strong>2. Host selection</strong> (<code>lib/bandit/pipeline.ex</code>)</p>\n<p><code>determine_host_and_port!/4</code> has three clauses. The HTTP/1.1 clause calls <code>required_host_header!/1</code>, which parses the <code>Host</code> header with <code>Bandit.Headers.parse_hostlike_header!/1</code> and raises a 400 on a malformed value, and then discards that result whenever <code>target_host</code> is set, returning <code>to_string(target_host)</code> and <code>target_port</code> instead. The fallback clause used for HTTP/1.0 and for <code>CONNECT</code> returns the target host and port directly and never consults the <code>Host</code> header. The precedence itself follows RFC 9112 section 3.2.2; the defect is that the value which wins is the one never validated.</p>\n<p><strong>3. Effect</strong></p>\n<p><code>build_conn!/6</code> places the pair into the <code>URI</code> from which <code>Plug.Conn.Adapter.conn/5</code> builds <code>conn.host</code> and <code>conn.port</code>. The application therefore sees host values Bandit rejects on every other route into the same field, and for <code>CONNECT</code> a binary where <code>Plug.Conn.port_number/0</code> promises an integer, which makes <code>Plug.Conn.request_url/1</code> raise.</p>"},{"base64":false,"type":"text/markdown","value":"**1. Request-target parsing** (`lib/bandit/http1/socket.ex`)\n\n`:erlang.decode_packet/3` returns an absolute-form target as `{:absoluteURI, scheme, host, port, path}` and an authority-form (`CONNECT`) target as `{:scheme, host, port}`. `resolve_request_target!/2` unwraps both into a `{scheme, host, port, path}` tuple and forwards `host` and `port` as received. `validate_request_line!/2` only rejects bytes at or below `0x20` and `0x7F`, so userinfo, delimiters, backslashes, bytes `0x80` to `0xFF`, invalid IP literals and out-of-range ports pass. For `CONNECT`, `port` is the unparsed text after the first colon.\n\n**2. Host selection** (`lib/bandit/pipeline.ex`)\n\n`determine_host_and_port!/4` has three clauses. The HTTP/1.1 clause calls `required_host_header!/1`, which parses the `Host` header with `Bandit.Headers.parse_hostlike_header!/1` and raises a 400 on a malformed value, and then discards that result whenever `target_host` is set, returning `to_string(target_host)` and `target_port` instead. The fallback clause used for HTTP/1.0 and for `CONNECT` returns the target host and port directly and never consults the `Host` header. The precedence itself follows RFC 9112 section 3.2.2; the defect is that the value which wins is the one never validated.\n\n**3. Effect**\n\n`build_conn!/6` places the pair into the `URI` from which `Plug.Conn.Adapter.conn/5` builds `conn.host` and `conn.port`. The application therefore sees host values Bandit rejects on every other route into the same field, and for `CONNECT` a binary where `Plug.Conn.port_number/0` promises an integer, which makes `Plug.Conn.request_url/1` raise."}],"value":"1. Request-target parsing (lib/bandit/http1/socket.ex)\n\n:erlang.decode_packet/3 returns an absolute-form target as {:absoluteURI, scheme, host, port, path} and an authority-form (CONNECT) target as {:scheme, host, port}. resolve_request_target!/2 unwraps both into a {scheme, host, port, path} tuple and forwards host and port as received. validate_request_line!/2 only rejects bytes at or below 0x20 and 0x7F, so userinfo, delimiters, backslashes, bytes 0x80 to 0xFF, invalid IP literals and out-of-range ports pass. For CONNECT, port is the unparsed text after the first colon.\n\n2. Host selection (lib/bandit/pipeline.ex)\n\ndetermine_host_and_port!/4 has three clauses. The HTTP/1.1 clause calls required_host_header!/1, which parses the Host header with Bandit.Headers.parse_hostlike_header!/1 and raises a 400 on a malformed value, and then discards that result whenever target_host is set, returning to_string(target_host) and target_port instead. The fallback clause used for HTTP/1.0 and for CONNECT returns the target host and port directly and never consults the Host header. The precedence itself follows RFC 9112 section 3.2.2; the defect is that the value which wins is the one never validated.\n\n3. Effect\n\nbuild_conn!/6 places the pair into the URI from which Plug.Conn.Adapter.conn/5 builds conn.host and conn.port. The application therefore sees host values Bandit rejects on every other route into the same field, and for CONNECT a binary where Plug.Conn.port_number/0 promises an integer, which makes Plug.Conn.request_url/1 raise."}]}},"cveMetadata":{"assignerOrgId":"6b3ad84c-e1a6-4bf7-a703-f496b71e49db","assignerShortName":"EEF","cveId":"CVE-2026-105660","datePublished":"2026-10-15T18:37:02.485Z","dateReserved":"2026-10-10T13:15:02.320Z","dateUpdated":"2026-10-15T18:37:02.485Z","state":"PUBLISHED"},"dataType":"CVE_RECORD","dataVersion":"5.2"}