Summary
An authorization flaw in 9Router leaves the /codex/* endpoint unprotected, allowing requests to bypass the API-key gate used for other API routes.
Under certain configurations, a remote unauthenticated attacker can trigger upstream LLM provider calls using operator-stored credentials, potentially consuming resources and exposing sensitive usage patterns.
Affected context
This vulnerability appears in 9Router deployments that rely on src/dashboardGuard.js to enforce API-key protection for core routes such as /v1, /v1beta, /api/v1, and /api/v1beta.
It surfaces when Next.js rewrites /codex/* to /api/v1/responses, but /codex itself is omitted from the guard logic, leaving a path that can be invoked without passing through the intended authorization checks.
Exploit preconditions
- Attack surface: Public HTTP endpoints exposed by the 9Router instance
- Required access: No prior authentication; the attacker only needs network access to the router
- Trigger point: Sending requests directly to
/codex/*, which are rewritten to/api/v1/responseswithout API-key enforcement - Why exploitation is possible: The authorization middleware is applied selectively to known API paths and omits
/codex, creating an inconsistent access control policy (CWE-862/863) that can be abused to reach protected behavior via an unguarded route
Why this happens
The underlying bug is an incomplete access control configuration, where the authorization guard in src/dashboardGuard.js is applied to several canonical API paths but fails to include the /codex route.
Because Next.js rewrites /codex/* to /api/v1/responses, the logical behavior of a protected endpoint can be reached through an unprotected alias.
This maps to CWE-862: Missing Authorization and CWE-863: Incorrect Authorization, where a mismatch between intended policy and actual enforcement leaves sensitive functionality exposed.
Potential impact
- An attacker may trigger upstream LLM provider calls using operator-managed credentials.
- An attacker could consume API quotas and incur unexpected costs for the operator.
- An attacker can potentially infer or abuse prompt-handling behavior and application logic mediated by the router.
- The system may log attacker-driven traffic under legitimate provider accounts, skewing monitoring and analytics.
General mitigation guidance
Effective mitigation centers on making access control consistent and centralized rather than path-specific and ad hoc.
Typical defensive patterns include:
- Applying authorization middleware at a common entry point for all API-like routes, including rewrites and aliases.
- Defining an explicit allowlist or policy that binds access decisions to capabilities rather than URL fragments.
- Ensuring that route rewrites and proxy rules are subject to the same access checks as their target endpoints.
- Minimizing the number of distinct code paths that can reach sensitive operations such as upstream provider calls, and running those paths under least-privilege credentials.
How teams detect issues like this
Organizations can look for similar issues by:
- Reviewing route definitions, rewrite rules, and middleware chains to confirm that all externally reachable paths pass through authorization checks.
- Using static analysis or configuration linters to flag endpoints that invoke sensitive operations without preceding auth or policy enforcement.
- Implementing tests that simulate unauthenticated requests across the full route surface, including aliases and rewrites, and verifying consistent access denial.
- Applying policy-as-code tools that enforce mandatory authorization for categories of routes, such as anything that proxies requests to external providers.

