bandit is vulnerable to Improper Input Validation
55
CVE Score
Medium
Improper Input Validation
In bandit, the authority of an HTTP/1 absolute-form or authority-form (CONNECT) request target is not validated. Although the Host header is validated and rejected with a 400 when malformed, the request-target authority takes precedence (per RFC 9112) and is passed unchecked to the application as conn.host and conn.port. An unauthenticated remote attacker can set these to values outside the RFC 3986 host grammar, such as userinfo (good.example@evil.example), NUL/DEL/non-ASCII bytes, invalid IP literals or ports outside 1..65535. For CONNECT, conn.port is left as an unparsed binary, which makes Plug.Conn.request_url/1 raise. Applications that build absolute URLs from conn.host (for example password-reset or verification links via Plug.Conn.request_url/1 or Phoenix URL helpers) may emit links pointing to an attacker-chosen host.
Upgrade the bandit library to the patch version. As a workaround, add a plug ahead of any code that reads conn.host or conn.port that checks conn.host against an allow-list of the hostnames your application serves, verifies conn.port is an integer, and halts the request with a 400 response otherwise.
You are affected if you are using a version that falls within the vulnerable range and your application reads conn.host or conn.port, for example to build absolute URLs.
0.6.0 - 1.12.5
Fixed in 1.13.0bandit is vulnerable to Improper Input Validation in versions 0.6.0 - 1.12.5.
Secure your code, cloud, and runtime in one central system. Connect a repo to discover what the reasoning agents find in your codebase.
No credit card required | Scan results in 32 seconds.
I consent to receiving marketing communications based on Aikido’s Privacy Policy.
SOC 2Compliant
ISO 27001Compliant
ISO 42001Compliant© All Intel data is openly available and commercially licensed.