/

CVE-2026-49352

Severity:

CRITICAL RISK

(9.8)

Hardcoded JWT Secret (CWE-798) in 9Router Auth Flow

CVE-2026-49352

Deferred

Vulnerability type

Category:

Hardcoded Cryptographic Secret

CWE:

CWE-798

Impact:

Authentication Bypass and Account Compromise

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

9Router used a hardcoded fallback JWT secret when the environment variable JWT_SECRET was unset, enabling attackers to forge authentication tokens.

Under deployments where this default secret remained active, a remote attacker could generate valid auth_token cookies and access protected dashboards without legitimate credentials.

Affected context

This vulnerability arises in 9Router deployments (versions 0.2.21 through 0.4.44) where the JWT_SECRET environment variable is not configured and the application silently falls back to a built-in secret string.

It primarily affects server-side authentication flows implemented in routes and middleware that rely on JWTs for session validation, including login handling and dashboard session management.

The risk is heightened in environments where default configuration is used in production, or where operators assume JWT-based sessions are secure without verifying that unique secrets are set.

Exploit preconditions

  • Attack surface: Public-facing authentication endpoints and routes that issue or validate JWT-based auth_token cookies.
  • Required access: Network access to the 9Router instance; no prior authentication is needed if the attacker knows or can discover the hardcoded secret.
  • Trigger point: The application signs and verifies JWTs using the default secret when JWT_SECRET is unset, allowing forged tokens to be accepted as valid.
  • Why exploitation is possible: The JWT signing key is a static, hardcoded value embedded in the source code, so an attacker with knowledge of the default secret can generate tokens that pass signature verification and gain access as any user the token claims.

Why this happens

The underlying issue is the use of a hardcoded fallback secret for cryptographic operations, specifically JWT signing and verification, instead of requiring a unique, high-entropy key per deployment.

This maps to CWE-798: Use of Hard-coded Credentials, where sensitive authentication material is embedded directly in code and reused across installations.

Conceptually, the design trusts an invariant constant ("9router-default-secret-change-me") as a secure key, turning authentication from a secret-based system into one where the "secret" is effectively public to anyone who has seen the code or documentation.

Potential impact

  • Attackers can forge valid auth_token cookies and bypass authentication controls.
  • Unauthorized access to user dashboards and administrative interfaces.
  • Impersonation of arbitrary users by crafting tokens with chosen identities or roles.
  • Exposure or manipulation of configuration, routing rules, or API credentials stored in authenticated areas.
  • Potential pivot into integrated services or upstream/downstream systems that trust 9Router sessions.

General mitigation guidance

Effective mitigation focuses on removing hardcoded secrets and enforcing strong, deployment-specific cryptographic keys.

Security patterns include:

  • Treating JWT signing keys as mandatory configuration secrets, failing fast if they are absent instead of falling back to defaults.
  • Generating high-entropy secrets using robust secret management solutions, rather than human-chosen strings checked into source control.
  • Isolating authentication code so that any default or test keys cannot be active in production build paths.
  • Applying least-privilege to authenticated roles, reducing the blast radius if a session key is ever exposed.
  • Incorporating configuration validation at startup to ensure all security-critical keys are present and meet minimum strength requirements.

How teams detect issues like this

Organizations can detect similar issues by:

  • Applying static analysis rules to spot hardcoded secrets, credential-like strings, and crypto keys in authentication modules and middleware.
  • Reviewing code for fallback behavior around environment-based configuration, especially any "default" keys used for JWT, cookies, or API tokens.
  • Implementing security-focused configuration checks in CI/CD that fail builds when security-relevant environment variables are missing or unsafe defaults are present.
  • Using secret scanning tools to monitor repositories for patterns resembling keys, tokens, or passwords, including in test code and example configs.
  • Conducting targeted code reviews of auth-related components (login routes, session libraries, middleware) to validate that all secrets are injected securely at runtime.

Sources

SourceLink
github.comgithub.com/decolua/9router/commit/fe3ce25ae3cda48c0702c2d452e17f6ec214009d
github.comgithub.com/decolua/9router/releases/tag/v0.4.44
github.comgithub.com/decolua/9router/security/advisories/GHSA-jphh-m39h-6gwx

Frequently asked

questions

It is broadly exploitable in any deployment where the default JWT secret is active. Because the secret is hardcoded and known, an attacker with network access can generate valid tokens without needing to compromise the server directly.

Only network-level access to the 9Router instance is required. If the hardcoded secret is in use, the attacker does not need prior authentication or local system access; knowledge of the default key is sufficient.

Remove all hardcoded secrets from the authentication code path and require a unique, high-entropy JWT signing key to be supplied via secure configuration. The application should refuse to start if a proper secret is not provided, rather than silently applying a default.

Establish secure configuration standards that forbid hardcoded credentials, enforce secret provisioning in deployment pipelines, and use automated secret scanning and static analysis to catch defaults and test keys before release. Regular security reviews of authentication and session management logic help ensure new code follows these patterns.

Find out what's already
exploitable in your codebase.