/

CVE-2026-62327

Severity:

CRITICAL RISK

(9.1)

Missing Auth on Usage Stats API Leaks Plaintext Keys

CVE-2026-62327

Deferred

Vulnerability type

Category:

Authentication and Sensitive Data Exposure

CWE:

CWE-306, CWE-522

Impact:

Account Takeover and Unauthorized Service Usage

Severity:

CRITICAL RISK

(9.1)

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 up to version 0.4.41 exposes a Next.js API endpoint that returns plaintext API keys, token usage, and billing metadata without any authentication checks.

A remote attacker can send a single unauthenticated request to /api/usage/stats to obtain full API key strings for all connected AI provider accounts, enabling unauthorized usage, billing fraud, and quota exhaustion.

Affected context

This vulnerability occurs in 9Router deployments that expose the /api/usage/stats Next.js API route to the network, such as public SaaS instances or self-hosted installations with external access.

It manifests when the route is deployed without authentication middleware or access control, and where the response payload includes plaintext API keys, usage metrics, and cost breakdowns for connected AI provider accounts.

The issue is most severe in environments where those provider keys grant broad access to paid AI APIs or where usage-based billing is enabled.

Exploit preconditions

  • Attack surface: Network-accessible Next.js API route at /api/usage/stats
  • Required access: None; the endpoint is callable without authentication or prior registration
  • Trigger point: A standard HTTP request (e.g., GET) to the stats endpoint
  • Why exploitation is possible: Missing authentication and authorization middleware on the route, combined with returning sensitive fields (plaintext API keys and detailed usage data) directly in the response payload

Why this happens

The root cause is a lack of access control on a sensitive backend endpoint, mapping to CWE-306: Missing Authentication for Critical Function.

A Next.js API route that surfaces internal usage statistics is implemented without enforcing authentication or checking the caller's identity, effectively treating all requests as trusted.

Additionally, the endpoint returns highly sensitive secrets in clear text (API keys) alongside usage and billing metadata, aligning with CWE-522: Insufficiently Protected Credentials, where credentials are exposed without appropriate protection or compartmentalization.

Abstractly, this reflects a pattern where observability or admin-oriented APIs are built without consistent security boundaries and where secrets are embedded directly in operational telemetry.

Potential impact

  • Attackers can obtain plaintext API keys for all connected AI provider accounts.
  • Unauthorized use of AI APIs under the victim's billing accounts.
  • Billing fraud and unexpected financial charges due to abusive or automated usage.
  • Quota exhaustion, degrading or denying service to legitimate users.
  • Potential downstream data exposure via abused AI provider APIs.
  • Reputational damage and support burden from compromised accounts.

General mitigation guidance

Effective mitigation focuses on enforcing strong access control for sensitive operational endpoints and eliminating direct exposure of secrets in telemetry.

Recommended patterns include:

  • Applying centralized authentication and authorization middleware to all API routes, especially those returning usage, billing, or administrative data.
  • Designing responses so that credentials (API keys, tokens) are never included in usage or stats payloads; expose opaque identifiers or partial, non-usable references where necessary.
  • Segmenting administrative and observability interfaces onto restricted networks or behind authenticated dashboards.
  • Treating API keys as high-value secrets, storing them using secure secret management systems and only exposing them to components that must use them, not monitoring endpoints.
  • Adopting a least-privilege principle for provider keys and using scoped credentials that minimize blast radius if misuse occurs.
  • Regularly reviewing API schemas and logging configurations to ensure sensitive fields are excluded from routine responses.

How teams detect issues like this

Organizations can detect similar issues by:

  • Running static or framework-aware analysis that checks for API routes without attached authentication middleware, especially under paths like /api/admin, /api/usage, or /api/stats.
  • Reviewing Next.js (or equivalent) route definitions to confirm all sensitive endpoints are wrapped in access control logic, using code review checklists focused on authentication coverage.
  • Implementing policy-as-code or configuration linting that flags any response schemas containing fields matching known secret patterns (e.g., apiKey, token, secret) in non-secure endpoints.
  • Monitoring logs for anonymous access to administrative or metrics endpoints and alerting on unusual access patterns.
  • Using automated application security testing tools to crawl exposed routes and identify unauthenticated endpoints returning sensitive or high-value data.

Sources

SourceLink
github.comgithub.com/decolua/9router/security/advisories/GHSA-vjc7-jrh9-9j86
vulncheck.comvulncheck.com/advisories/9router-unauthenticated-api-key-exposure-via-api-usage-stats

Frequently asked

questions

Yes, if the 9Router instance exposes the /api/usage/stats endpoint to the public internet or any network an attacker can reach, the vulnerability is remotely exploitable with a single unauthenticated request.

No. The core issue is missing authentication middleware on the stats endpoint, so no prior registration, login, or token is required to retrieve the plaintext API keys and usage data.

The safest pattern is to apply strict authentication and authorization to all administrative and metrics endpoints and to redesign the stats payload so that it never includes full API keys or other secrets. Access control should be enforced centrally to avoid route-specific omissions.

Adopt a security-by-default approach for all backend routes: require authentication unless a route is explicitly intended to be public, avoid returning secrets in responses or logs, and use code review and automated checks to validate that new endpoints comply with authentication and secret-handling policies.

Find out what's already
exploitable in your codebase.