Malformed Host headers (containing /, ?, or #) bypass path-based access controls in Starlette by shifting URL parsing boundaries, affecting AI agent infrastructure and MCP servers.
June 5, 2026
Summary
If your FastAPI/Starlette middleware gates auth decisions on request.url.path, you're vulnerable to authentication bypass regardless of how correctly your individual components behave. Patch urgency is high for any AI service exposed without reverse-proxy protection.
Why it matters
If your FastAPI/Starlette middleware gates auth decisions on request.url.path, you're vulnerable to authentication bypass regardless of how correctly your individual components behave. Patch urgency is high for any AI service exposed without reverse-proxy protection.
Implementation verdict
Upgrade to Starlette 1.0.1 immediately. This is not a single-file bug—it's a three-layer interaction issue (ASGI → Starlette → middleware). The vulnerability is mitigated if you front with CDN/load-balancer/reverse-proxy, but internal LLM deployments and MCP servers lack this protection by default. Worth testing now against badhost.org scanner.
Sources
Dev Signal
Get briefs like this in your inbox — free, every weekday.
100+ sources compressed into one 4-minute read. Ranked, cited, implementation-ready.