CVE-2026-48710 'BadHost' Exposes AI Agent Servers to Authentication Bypass via HTTP Host Header Manipulation
A critical vulnerability in Starlette, tracked as CVE-2026-48710, allows attackers to bypass authentication on FastAPI-based AI infrastructure by crafting malicious HTTP Host headers.

A newly disclosed critical vulnerability, tracked as CVE-2026-48710 and dubbed 'BadHost,' is putting thousands of AI-powered applications at risk by enabling authentication bypass through manipulated HTTP headers. The flaw affects Starlette versions before 1.0.1, a core framework widely used in FastAPI-based applications powering modern AI infrastructure, including LLM inference servers, agent frameworks, and MCP gateways. Security researchers warn that attackers can exploit this flaw to gain unauthorized access to protected API endpoints, exposing sensitive AI models, internal tools, and API keys.
The root cause lies in how Starlette constructs request URLs by concatenating the Host header with the request path to build `request.url`. Because the Host header is not properly sanitized, attackers can inject malicious values that alter how the application interprets the request path. For example, a crafted request such as 'GET /protected' with a 'Host: example.com/health?x=' header can cause the application to treat the request as if it targets '/health' instead of '/protected'. When authentication middleware relies on `request.url.path` to enforce access controls, this discrepancy allows attackers to bypass protections entirely.
This vulnerability particularly affects middleware that uses path-based logic for authentication and authorization checks, allowlist or denylist filtering, rate limiting or billing gates, and CSRF protection mechanisms. The issue spans multiple layers: ASGI servers, Starlette's URL handling, and developer-authored middleware, making it difficult to detect through conventional automated analysis.
BadHost poses a significant threat to AI ecosystems because many modern AI services rely on FastAPI and Starlette as their foundation. Platforms at risk include vLLM and LiteLLM inference and proxy servers, AI agent frameworks and orchestration backends, MCP (Model Context Protocol) servers and gateways, and tools such as Ray Serve, BentoML, and Google ADK-Python when they use custom middleware. MCP servers are especially vulnerable because they expose unauthenticated OAuth discovery endpoints by design, providing attackers with a predictable, reliable entry point for exploitation.
If successfully exploited, BadHost can enable attackers to access restricted LLM endpoints, extract API keys and credentials, interact with internal agent tooling, and abuse AI compute resources without legitimate authorization. Organizations are strongly advised to implement mitigations without delay.
Upgrading Starlette to version 1.0.1 or later ensures that malformed Host headers are handled safely, closing the primary attack vector. Developers should avoid using `request.url.path` for security decisions and instead rely on more robust mechanisms such as FastAPI's `Depends()` or `Security()` for authentication and authorization. Deploying reverse proxies like Nginx, Caddy, or HAProxy in front of ASGI servers helps validate and normalize Host headers before they reach the application, further reducing exposure. Where middleware must inspect paths, replacing `request.url.path` with `scope['path']` provides a safer basis for logic.
Discovered by X41 D-Sec during an OSTIF-sponsored audit, BadHost underscores the growing complexity of securing interconnected frameworks and highlights the need for thorough reviews of middleware logic and strict input validation to prevent similar attack paths in the future.