Packages / @nestjs/platform-fastify / Security

ModerateVulnerabilityGHSA-8wpr-639p-ccrjCVE-2025-69211Published 30 Dec 2025

Nest has a Fastify URL Encoding Middleware Bypass (TOCTOU)

Affected releases · @nestjs/platform-fastify

  • 11.x11.0.0 – 11.1.10Fixed in 11.1.11
  • 10.x10.0.0 – 10.4.22No fix on this line yet
  • 9.x and older6.0.0 – 9.4.3No fix, no longer updated

On 11.x, the newest line:

npm install @nestjs/platform-fastify@11.1.11
12.x
  1. Not affected

    12.0.0 – 12.2.0

    10 releases, latest

11.x
  1. Affected

    11.0.0 – 11.1.10

    33 releases

  2. Fixed

    11.1.11 – 11.2.7

    27 releases

10.x
  1. Affected

    10.0.0 – 10.4.22

    55 releases

9.x
  1. Affected

    9.0.0 – 9.4.3

    37 releases

8.x
  1. Affected

    8.0.0 – 8.4.7

    32 releases

7.x
  1. Affected

    7.0.0 – 7.6.18

    51 releases

6.x
  1. Affected

    6.0.0 – 6.11.11

    67 releases

312 stable releases of @nestjs/platform-fastify, oldest to newest, one row per major.

Is your project affected?

Paste your package.json, or type the range you declare for @nestjs/platform-fastify. It is read in your browser and sent nowhere.

What happens

A NestJS application is vulnerable if it meets all of the following criteria:

  1. Platform: Uses @nestjs/platform-fastify.

  2. Security Mechanism: Relies on NestMiddleware (via MiddlewareConsumer) for security checks (authentication, authorization, etc.), or through app.use()

  3. Routing: Applies middleware to specific routes using string paths or controllers (e.g., .forRoutes('admin')). Example Vulnerable Config:

// app.module.ts
export class AppModule implements NestModule {
  configure(consumer: MiddlewareConsumer) {
    consumer
      .apply(AuthMiddleware) // Security check
      .forRoutes('admin');   // Vulnerable: Path-based restriction
  }
}

Attack Vector:

  • Target Route: /admin

  • Middleware Path: admin

  • Attack Request: GET /%61dmin

  • Result: Middleware is skipped (no match on %61dmin), but controller for /admin is executed.

Consequences:

  • Authentication Bypass: Unauthenticated users can access protected routes.

  • Authorization Bypass: Restricted administrative endpoints become accessible to lower-privileged users.

  • Input Validation Bypass: Middleware performing sanitization or validation can be skipped.

Patches

Patched in @nestjs/platform-fastify@11.1.11

Resources

Credit goes to Hacktron AI for reporting this issue.