Summary
9Router incorrectly trusts the client-supplied Host header to decide whether a /v1 LLM proxy request is local, enabling attackers to spoof localhost and bypass API-key checks.
When exposed in its default configuration, this can let unauthenticated remote users invoke upstream AI providers with stored credentials and drive server-side requests toward internal or metadata endpoints.
Affected context
This vulnerability affects 9Router deployments that:
- Expose the /v1 LLM proxy endpoint over a network interface
- Use Host-based logic to treat localhost as implicitly trusted
- Store provider credentials for upstream AI services
- Enable /v1/search with configurable provider_options.baseUrl values
In this context, the router relies on HTTP headers under client control to distinguish local traffic, rather than checking the actual connection source or enforcing strong authentication on all external requests.
Exploit preconditions
- Attack surface: Publicly or internally reachable 9Router HTTP endpoints under /v1 and /v1/search
- Required access: Remote, unauthenticated HTTP access; no prior credentials needed
- Trigger point: Sending requests with a forged
Host: localhostheader (or similar trusted value) to /v1 endpoints - Why exploitation is possible:
- The router interprets the Host header as evidence of a local request
- Local requests are treated as trusted and allowed to bypass API-key authentication
- For /v1/search, user-controlled provider_options.baseUrl is used to construct outgoing requests, enabling SSRF toward internal or cloud-metadata hosts
Why this happens
The core issue is a trust decision based on client-controlled HTTP metadata, specifically the Host header, which is not a reliable indicator of the request's true origin.
This maps primarily to CWE-290: Authentication Bypass by Spoofing and CWE-348: Use of Incorrectly-Resolved Name or Service, where security logic incorrectly relies on name resolution or header values rather than actual connection properties.
Additionally, allowing user-controlled base URLs to drive backend HTTP requests matches CWE-918: Server-Side Request Forgery, with CWE-1327 reflecting the conflation of external and internal trust boundaries.
Abstractly, the pattern is: "treat a syntactic property of a request (header or URL) as proof of trustworthiness," leading to both authentication bypass and SSRF.
Potential impact
- Unauthenticated use of stored upstream provider credentials to invoke LLM APIs
- Consumption of quota or incurring cost on third-party AI providers without authorization
- Server-Side Request Forgery (SSRF) to internal services reachable from the router
- Access to cloud metadata services, potentially exposing credentials or tokens
- Indirect exposure of internal network topology through error responses or timing differences
- Expansion of an attacker's foothold by chaining SSRF with other internal weaknesses
General mitigation guidance
Effective mitigation focuses on separating trust decisions from client-controlled headers and constraining outbound requests:
- Treat all external HTTP requests as untrusted by default, regardless of Host, and require explicit authentication for sensitive routes.
- Base "local" or "internal" checks on connection-level attributes (e.g., server binding, source IP, or listener configuration), not on Host or other headers.
- Introduce a strict allowlist for any outbound base URLs used by /v1/search and similar features, restricting them to known, trusted domains or services.
- Normalize and validate any user-provided URLs, rejecting IP literals, link-local addresses, and metadata endpoints by pattern or network range.
- Isolate routing components with least privilege, limiting their ability to reach internal networks or cloud metadata endpoints at the network or firewall layer.
- Prefer configuration-driven trust (e.g., explicit internal endpoints configuration) over implicit trust derived from request headers.
How teams detect issues like this
Detecting this type of issue and its exploitation typically involves a combination of code-level and operational techniques:
- Static analysis and code review:
- Search for logic that bases authentication or trust on Host, X-Forwarded-Host, or similar headers.
- Flag any routing or access-control conditions that compare header values against "localhost" or internal hostnames.
- Identify code paths where user-controlled URL fields (such as provider_options.baseUrl) are used directly to make backend HTTP requests.
- Configuration and policy checks:
- Enforce policies that disallow arbitrary outbound connections from router components, or require explicit allowlists.
- Use security linters or automated review tools to enforce patterns like "no trust decisions based on Host."
- Runtime monitoring:
- Log and monitor Host headers and baseUrl parameters for anomalous values (e.g., localhost, 127.0.0.1, 169.254.169.254).
- Enable alerting on outbound requests from the router to sensitive ranges (internal IPs, metadata services).
- Correlate unexpected spikes in upstream provider usage with incoming requests lacking authentication tokens.

