9router Hardcoded JWT Secret Authentication Bypass (CVE-2026-49352)
Published: 2026-11-27 • Researcher: covepseng (PoC author, github.com/covepseng); advisory by decolua / 9router maintainers, analysis published at return-zero.dev
- Severity
- Critical
- CVE
- CVE-2026-49352 / GHSA-jphh-m39h-6gwx
- Category
- web
- Affected product
- 9router (self-hosted Node.js / Next.js proxy for AI coding tools)
- Affected versions
- 0.2.21 through 0.4.44 inclusive (fixed in 0.4.44 per NVD; the upstream PoC README states 0.2.21 to 0.4.41 with the fix in 0.4.45 — see Notes)
- Disclosed
- 2026-11-27
- Patch status
- Patched
Tags
References
- https://nvd.nist.gov/vuln/detail/CVE-2026-49352
- https://github.com/decolua/9router/security/advisories/GHSA-jphh-m39h-6gwx
- https://github.com/decolua/9router/commit/fe3ce25ae3cda48c0702c2d452e17f6ec214009d
- https://github.com/decolua/9router/releases/tag/v0.4.44
- https://github.com/covepseng/cve-2026-49352-poc
- https://return-zero.dev/posts/cve-2026-49352
Archive entry
intelseclab/poc-archiveOn this page
Metadata
| Field | Value |
|---|---|
| Date Added | 2026-11-27 |
| Last Updated | 2026-07-06 (upstream commit 30f82f10c734defe49752463ef2ac36377be4c86, “feat: first commit”) |
| Author / Researcher | covepseng (PoC author, github.com/covepseng); advisory by decolua / 9router maintainers, analysis published at return-zero.dev |
| CVE / Advisory | CVE-2026-49352 / GHSA-jphh-m39h-6gwx |
| Category | web |
| Severity | Critical |
| CVSS Score | 9.8 (CVSS 3.1 — per CVE record / NVD); EPSS 0.02193 |
| Status | Weaponized |
| Tags | 9router, JWT, hardcoded-secret, CWE-798, authentication-bypass, unauthenticated, Next.js, Node.js, AI-router |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | 9router (self-hosted Node.js / Next.js proxy for AI coding tools) |
| Versions Affected | 0.2.21 through 0.4.44 inclusive (fixed in 0.4.44 per NVD; the upstream PoC README states 0.2.21 to 0.4.41 with the fix in 0.4.45 — see Notes) |
| Language / Platform | JavaScript / TypeScript (Node.js 20, Next.js); exploit written in Go 1.22+ |
| Authentication Required | No — the forged cookie is the authentication |
| Network Access Required | Yes — HTTP(S) access to the 9router dashboard port (default 20128) |
Summary
9router signed dashboard session JWTs with a secret taken from an environment variable, but fell back to the public constant 9router-default-secret-change-me whenever that variable was unset. The same literal was committed in the login route, the middleware and the dashboard session helper, so it is not a secret in any sense. Because the request guard only verifies the token signature and never looks up a server-side session, any remote attacker can sign a token claiming authenticated=true and be treated as a logged-in dashboard user. From there the attacker reaches protected dashboard pages and the settings database endpoint that returns provider connections, proxy pools and stored API keys.
Vulnerability Details
Root Cause
Two independent modules derived their signing key the same way: new TextEncoder().encode(process.env.JWT_SECRET || “9router-default-secret-change-me”). The literal appears in src/app/api/auth/login/route.js (token issuance), in src/middleware.js, and later in src/lib/auth/dashboardSession.js (token verification). The value is published in the open-source repository, so an attacker knows the key for every deployment that never set JWT_SECRET — the default for quick-start and docker-run setups that skip the environment configuration step. Verification reduced identity to a signature check: hasValidToken() called jwtVerify(token, SECRET) and returned true on success, with no session record lookup, no issuer or audience check and no binding to a login event. A valid HS256 signature over an attacker-chosen payload was therefore sufficient proof of identity. The fix in 0.4.44 removes the fallback and requires an explicitly configured secret.
Attack Vector
Unauthenticated HTTP request: the attacker mints an HS256 JWT with the payload {“authenticated”: true, “iat”:
Impact
Full authentication bypass on the 9router dashboard, which in practice means administrative control of the proxy: reading the settings database (provider connections, proxy pools, model aliases, API keys and combos returned by /api/settings/database), adding or replacing upstream provider credentials, redirecting the operator’s AI traffic and consuming or exfiltrating the API keys stored there. Because 9router sits between the operator and paid model providers, the exposure is both data (keys, provider accounts) and control (traffic interception).
Environment / Lab Setup
OS: Linux x86_64 with Podman >= 4.0 and podman-compose (Docker plus docker compose works too)
Target: 9router built from source at tag v0.4.30 (inside the affected range), JWT_SECRET intentionally unset
Attacker: Same host; Go >= 1.22 with network access to 127.0.0.1:20128
Tools: podman-compose, git, npm (inside image build), curl, Go toolchainThe container build clones decolua/9router at the pinned tag, installs dependencies, runs the Next.js production build and starts it on port 20128. The image deliberately does not define JWT_SECRET, reproducing the vulnerable default deployment. Note that the archived copy omits upstream go.sum, so regenerate it before running the exploit (see Step 2).
Setup Steps
| |
Proof of Concept
Step-by-Step Reproduction
Confirm the target is reachable and unauthenticated — the dashboard redirects to the login page.
Shell script1curl -si http://localhost:20128/dashboard | head -3Prepare the Go exploit — the archived copy ships go.mod but not go.sum (archive policy excludes lockfiles), so resolve dependencies once.
Shell script1 2cd exploit go mod tidy # regenerates go.sum and fetches github.com/golang-jwt/jwt/v5 v5.2.1Forge a token and request the dashboard — the tool signs the payload with the hardcoded fallback secret and sends it as the auth_token cookie.
Shell script1go run exploit.go -target http://localhost:20128Demonstrate the credential exposure — with -probe the same cookie is replayed against the settings database endpoint.
Shell script1go run exploit.go -target http://localhost:20128 -probeConfirm the negative control — set JWT_SECRET to a random value on the container and repeat; the forged token is rejected with a redirect to /login.
Shell script1 2podman-compose down -v # edit podman-compose.yml to add JWT_SECRET: $(openssl rand -hex 32) under environment, then rebuild and rerun
Exploit Code
See
exploit/exploit.go(Go) in this folder; the lab definition lives indockerfileandpodman-compose.yml.
| |
Expected Output
[1] Forging dashboard session JWT with the hardcoded fallback secret...
[+] Forged auth_token:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdXRoZW50aWNhdGVkIjp0cnVlLCJleHAiOjI5MTgzNjMwMTksImlhdCI6MTc4MzA2NzAxOX0.yYdNxS-nYuxv609j1w7juimNVM1RROAfVRjZyt6TU3M
[2] Requesting /dashboard with the forged auth_token cookie...
[+] 200 OK — authentication bypass confirmed against http://localhost:20128
[3] Probing /api/settings/database for exposed credentials (per advisory attack scenario)...
[+] /api/settings/database returned 200
{"settings":{},"providerConnections":[],"providerNodes":[],"proxyPools":[],"apiKeys":[],"combos":[],"modelAliases":{},"customModels":[],"mitmAlias":{},"pricing":{}}A non-vulnerable instance (JWT_SECRET set) produces instead: [-] 307 redirect (likely to /login) — the forged token was rejected, target is probably not vulnerable or JWT_SECRET is set.
Detection & Indicators of Compromise
"GET /dashboard HTTP/1.1" 200 (with Cookie: auth_token=...)
"GET /api/settings/database HTTP/1.1" 200SIEM / IDS rule (example):
alert http any any -> any any (msg:"9router forged JWT session (hardcoded secret)"; \
flow:to_server; content:"auth_token="; http_cookie; \
content:"/dashboard"; http_uri; sid:9003101;)Watch for the same source IP hitting the dashboard and the settings database within one session without ever POSTing to /api/auth/login, and for API-key usage from unfamiliar source addresses shortly afterwards.
Remediation
| Action | Detail |
|---|---|
| Patch | Upgrade to 9router 0.4.44 or later (the upstream PoC README references 0.4.45 — see Notes); the fix commit is fe3ce25ae3cda48c0702c2d452e17f6ec214009d and the release is v0.4.44 |
| Workaround | If upgrading immediately is not possible, set JWT_SECRET on every instance to a long random value (for example openssl rand -hex 32) and restart, so the hardcoded fallback is never used |
| Config Hardening | Treat JWT_SECRET as a required deployment secret: inject it from a secret manager, fail startup when it is absent, and rotate it if the instance ever ran without it (rotation invalidates forged as well as legitimate tokens) |
| Post-exposure | Assume dashboard-stored provider credentials and API keys were readable; revoke and reissue upstream provider keys, review proxy pool and provider connection settings for unauthorized changes |
References
Notes
Verdict: genuine, non-malicious exploitability PoC. The repository contains a complete Go exploit that forges the dashboard JWT, a lab Dockerfile that builds the vulnerable tag with JWT_SECRET unset, and a compose file; the upstream README documents a confirmed 200 OK against that lab. No scanner, credential stealer, persistence or C2 logic is present — the database probe only retrieves the settings JSON the advisory describes. Archived as-is apart from an added disclaimer header in exploit/exploit.go.
Files copied: exploit/exploit.go, exploit/go.mod, dockerfile, podman-compose.yml, and the upstream README as upstream-README.md. Not copied: exploit/go.sum (archive policy excludes lockfiles; regenerate with go mod tidy), the .git directory, and the upstream repository’s build artifacts.
Version-range discrepancy: the CVE record states “from 0.2.21 until 0.4.44” fixed in 0.4.44, while the PoC README’s table says 0.2.21 to 0.4.41 fixed in 0.4.45. The lab pins v0.4.30, inside both ranges, so the reproduction is unaffected; operators should follow the fixed version named by the vendor release.
License: neither the PoC repository nor its README declares a license. Copyright remains with the upstream author; the files are archived here unmodified (plus the disclaimer header) for research and defensive reference. Anyone redistributing them should seek permission from the author.
Limitations: the exploit only works when JWT_SECRET is unset, so hardened deployments are immune; the container build downloads the 9router source and runs a full npm install and Next.js build, which needs network access and several minutes; the token TTL flag changes only the exp claim, which the vulnerable code never bounds-checks; and the -probe path returns whatever the deployment stores, which is empty on a fresh container, so a clean JSON body still counts as successful unauthenticated access.