Description
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.

Applications 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.

This issue affects bandit: from 0.6.0 before 1.13.0.
Published: 2026-10-15
Score: 6.9 Medium
EPSS: < 1% Very Low
KEV: No
Impact: Potential for attacker‑controlled host and port resolution leading to malicious URL generation
Action: Patch immediately
AI Analysis

Impact

Bandit does not properly validate the authority component of an HTTP/1 request‑target, allowing an unauthenticated remote actor to set conn.host and conn.port to values that violate RFC 3986. The value taken from the request target overrides a valid Host header, and Bandit passes these unchecked values to the application. If the application builds absolute URLs from conn.host, it can emit links or URLs that point to attacker‑chosen domains or ports, potentially enabling phishing or link‑smuggling attacks. The vulnerability does not affect basic message framing and contains no injection of CR/LF into the target host.

Affected Systems

The issue exists in Bandit version 0.6.0 through 1.12.x. Versions 1.13.0 and later contain the fix. The affected product is the open‑source Bandit framework maintained by mtrudel.

Risk and Exploitability

The CVSS score of 6.9 denotes moderate severity, and the EPSS score of less than 1% indicates a very low probability of current exploitation. The vulnerability is not listed in the CISA KEV catalog. Attackers can trigger the flaw simply by sending an HTTP/1 request with an absolute or authority‑form target such as GET http://evil.example@good.example/…; no authentication is required. The risk arises only if the receiving application uses conn.host/conn.port to construct absolute URLs or to initiate outbound connections, so the impact is limited to those scenarios.

Generated by OpenCVE AI on October 16, 2026 at 17:29 UTC.

Remediation

Vendor Workaround

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.


OpenCVE Recommended Actions

  • Upgrade Bandit to version 1.13.0 or later where host/port validation has been added.
  • If an upgrade is not immediately possible, insert a plug before any code that reads conn.host or conn.port that checks conn.host against an allow‑list of the hostnames your site serves, verifies that conn.port is a valid integer, and halts the request with a 400 response if the checks fail.
  • Avoid building absolute URLs from conn.host; instead use relative paths or explicitly construct URLs using a trusted base domain.

Generated by OpenCVE AI on October 16, 2026 at 17:29 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Fri, 16 Oct 2026 20:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'poc', 'Technical Impact': 'partial'}, 'version': '2.0.3'}


Thu, 15 Oct 2026 18:45:00 +0000

Type Values Removed Values Added
Description 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. Applications 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. This issue affects bandit: from 0.6.0 before 1.13.0.
Title Unvalidated HTTP/1 request-target authority lets a client choose conn.host and conn.port in Bandit
First Time appeared Mtrudel
Mtrudel bandit
Weaknesses CWE-1286
CPEs cpe:2.3:a:mtrudel:bandit:*:*:*:*:*:*:*:*
Vendors & Products Mtrudel
Mtrudel bandit
References
Metrics cvssV4_0

{'score': 6.9, 'vector': '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'}


cve-icon MITRE

Status: PUBLISHED

Assigner: EEF

Published:

Updated: 2026-10-16T20:02:38.784Z

Reserved: 2026-10-10T13:15:02.320Z

Link: CVE-2026-105660

cve-icon Vulnrichment

Updated: 2026-10-16T20:02:31.139Z

cve-icon NVD

Status : Deferred

Published: 2026-10-15T19:17:16.290

Modified: 2026-10-16T21:17:16.750

Link: CVE-2026-105660

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-10-23T19:00:20Z

Weaknesses
  • CWE-1286

    Improper Validation of Syntactic Correctness of Input