Severity:

CRITICAL RISK

(9.8)

Authorization Bypass in NestJS Fastify Platform

CVE-2026-2293

Modified

Vulnerability type

Category:

Authorization Bypass

CWE:

CWE-863, CWE-551

Impact:

Authentication and Authorization Bypass

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

A logic flaw in NestJS applications using @nestjs/platform-fastify can allow attackers to bypass authentication and authorization middleware when certain Fastify path-normalization options are enabled.

By crafting requests that are normalized differently by Fastify than they are matched by NestJS routing and guards, an attacker may gain access to protected routes that should require valid credentials or specific privileges.

Affected context

This vulnerability affects NestJS applications that:

  • Use the Fastify adapter (@nestjs/platform-fastify) for HTTP handling
  • Enable Fastify path-normalization options (such as those that alter or canonicalize URLs)
  • Rely on NestJS guards, interceptors, or middleware for authentication/authorization checks on specific route patterns

The issue emerges when the HTTP server's normalized path used for routing differs from the raw or expected path on which security checks were conceptually based, creating inconsistencies between what is authenticated and what is actually served.

Exploit preconditions

  • Attack surface: Public or internal HTTP endpoints exposed by a NestJS application using Fastify.
  • Required access: Network access to the affected service; no prior authentication may be required for exploitation.
  • Trigger point: Submission of specially crafted HTTP request paths that are transformed by Fastify's normalization logic into routes protected by guards or middleware.
  • Why exploitation is possible: The authorization logic assumes a particular path structure, while the underlying HTTP server normalizes or rewrites that path before routing. This mismatch can cause NestJS to treat a request as matching a protected route without the corresponding guard or middleware being reliably applied, or to route traffic around intended protection.

Why this happens

The root cause is an inconsistent trust in normalized request paths between the HTTP adapter (Fastify) and the NestJS routing and guard system.

When path-normalization options are enabled, Fastify may canonicalize or alter incoming URLs (e.g., collapsing segments, handling trailing slashes, or resolving ambiguous path sequences) before routing. If NestJS guards, interceptors, or middleware are configured assuming a different path representation, security decisions may be made on one view of the path while routing decisions are made on another. This aligns with CWE-863: Incorrect Authorization, where authorization logic is incomplete or based on mismatched assumptions, allowing access to resources without proper checks.

Potential impact

  • Attackers may access API endpoints that are intended to require authentication.
  • Privilege escalation where low-privileged users can reach endpoints reserved for administrators or internal systems.
  • Exposure of sensitive data from protected resources (e.g., user profiles, configuration, or logs).
  • Unauthorized execution of state-changing operations such as account modifications, configuration changes, or business-critical transactions.
  • Potential pivot into broader system compromise depending on the sensitivity and capabilities of the exposed endpoints.

General mitigation guidance

Effective mitigation focuses on aligning security checks with actual routing behavior and reducing reliance on ambiguous path handling:

  • Prefer consistent, conservative path handling configuration: avoid enabling path-normalization options that can significantly alter requested URLs unless they are clearly understood and tested with security controls.
  • Ensure authentication and authorization guards are attached at module or global levels rather than relying solely on finely scoped path patterns that may be affected by normalization.
  • Treat all incoming paths as untrusted and validate them consistently before applying security decisions; avoid constructing security logic based on assumptions of raw URL structure.
  • Implement least-privilege principles for routes and controllers: deny by default and explicitly allow where required, so unexpected routing paths fail closed rather than open.
  • Use clear, unambiguous route definitions and avoid overlapping or ambiguous paths that can be interpreted differently after normalization.

How teams detect issues like this

Detection should target path-handling inconsistencies and missing guard coverage:

  • Static analysis and code review:
  • Review NestJS controllers and route definitions for endpoints that are expected to be protected but do not have guards or middleware consistently applied.
  • Look for usage of Fastify path-normalization or URL rewriting options and cross-check that corresponding routes are tested with those settings enabled.
  • Flag patterns where security decisions (e.g., guards, interceptors) depend on specific URL shapes that may be altered by normalization.
  • Configuration review:
  • Audit Fastify adapter configuration for path-normalization features and document their intended behavior.
  • Ensure that security policies describe how paths are normalized and routed under different deployment conditions (proxies, load balancers, etc.).
  • Runtime and log-based detection:
  • Monitor access logs for unexpected access patterns, such as protected endpoints being reached via unusual or malformed URLs.
  • Correlate authorization failures and successes across similar endpoints to identify suspicious discrepancies.
  • Automated tooling:
  • Incorporate API security testing tools or fuzzers that vary URL encodings, segments, and slashes to identify cases where protected endpoints become reachable without proper authentication.

Sources

SourceLink
fluidattacks.comfluidattacks.com/advisories/neton
github.comgithub.com/nestjs/nest/
github.comgithub.com/nestjs/nest/releases/tag/v11.1.14
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-2293
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2443367
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-2293.json

Frequently asked

questions

Yes. Any attacker who can send HTTP requests to the affected NestJS service may exploit this issue, provided the vulnerable path-normalization configuration is in place. No local access is required.

Not necessarily. If the affected endpoints are intended to require authentication, an attacker may still reach them without credentials by abusing the path-normalization behavior. Some scenarios, however, may require a low-privileged account to exploit specific privileged routes.

The safest pattern is to ensure that authorization logic is tightly coupled to the actual routing behavior. This typically involves:

  • Standardizing on a well-understood path configuration.
  • Applying guards and authentication middleware globally or at the module level for sensitive areas.
  • Avoiding reliance on subtle path patterns for security decisions when normalization or rewriting is enabled.

To prevent related flaws:

  • Treat URL/path handling as part of your core security design and document how normalization and routing are configured.
  • Establish coding guidelines requiring explicit guards for all sensitive controllers or modules, independent of path variations.
  • Include tests that exercise endpoints with variant and malformed paths under the real server configuration.
  • Incorporate security reviews of framework adapters (such as Fastify or Express) and their options as part of your deployment hardening checklist.
Find out what's already
exploitable in your codebase.