Vulnerabilities in pkg:npm/@nestjs/platform-fastify

PACKAGE
Advisory Summary

GHSA-9c5c-9qcx-q35q is a HIGH (CVSS 7.4) path-scoped middleware bypass vulnerability (CWE-436: Interpretation Conflict) affecting @nestjs/platform-fastify libraries in the npm ecosystem. The issue involves path-scoped middleware bypass via absolute-form request targets. Remediation is available by upgrading affected packages to version 11.2.4, 12.0.2.

6 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/@nestjs/platform-fastify

6 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/@nestjs/platform-fastify. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-9c5c-9qcx-q35q - HIGH @nestjs/platform-fastify: Path-scoped middleware bypass via absolute-form request targets
GHSA-6v32-fjc9-9qf6 CVE-2026-54281 HIGH Nest: Middleware Bypass on Fastify via Trailing Slash
GHSA-wf42-42fg-fg84 CVE-2026-33011 HIGH Nest Fastify HEAD Request Middleware Bypass
GHSA-r4wm-x892-vjmx CVE-2026-2293 HIGH Nest has a Fastify URL Encoding Middleware Bypass
GHSA-7q64-3rg2-h9pf - HIGH Duplicate Advisory: Nest has a Fastify URL Encoding Middleware Bypass
GHSA-8wpr-639p-ccrj CVE-2025-69211 MODERATE Nest has a Fastify URL Encoding Middleware Bypass (TOCTOU)

GHSA-9c5c-9qcx-q35q at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-9c5c-9qcx-q35q
Severity HIGH
CVSS v3.1 Base Score 7.4
CWE Classification CWE-436: Interpretation Conflict
Affected Product @nestjs/platform-fastify
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 7.4

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix GHSA-9c5c-9qcx-q35q

To remediate this vulnerability, upgrade all affected @nestjs/platform-fastify dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

@nestjs/platform-fastify fixed: 11.2.4
npm install @nestjs/platform-fastify@11.2.4
@nestjs/platform-fastify fixed: 12.0.2
npm install @nestjs/platform-fastify@12.0.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls @nestjs/platform-fastify

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-9c5c-9qcx-q35q, inspect your project dependencies using npm:

npm ls @nestjs/platform-fastify

Analyze the terminal output to locate any version of @nestjs/platform-fastify in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 11.2.4), your application is affected.

Note: The npm ls @nestjs/platform-fastify command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-436: Interpretation Conflict, where product a handles inputs or steps differently than product b, which causes a to perform incorrect actions based on its perception of b's state. In @nestjs/platform-fastify, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

| Field | Value | | --- | --- | | Ecosystem | npm | | Package | `@nestjs/platform-fastify` | | Affected versions | `>= 12.0.0, < 12.0.2` and `< 11.2.4` | | Patched versions | `12.0.2` and `11.2.4` (upgrade to `12.0.3` / `11.2.5`) | ### Summary On the Fastify adapter, an HTTP request that uses an **absolute-form request target** (`GET http://host/path HTTP/1.1` instead of `GET /path HTTP/1.1`) reaches the route handler without running the path-scoped Nest middleware bound to that route. Applications that enforce authentication or authorization in middleware execute the protected handler with those checks skipped. ### Impact Any application that - uses `@nestjs/platform-fastify`, and - binds middleware to specific paths via `MiddlewareConsumer.forRoutes(...)` or `.exclude(...)`, and - is reachable by a client that controls the raw request line. Node's HTTP server accepts absolute-form targets, so no special server configuration is needed. Exposure is reduced when a reverse proxy in front of the application rewrites the request target to origin-form, which most do. Where the bypassed middleware performs authentication or authorization, the result is an authentication or authorization bypass. Where it performs logging, rate limiting or body handling, those are silently skipped instead. ### Details Fastify's router (`find-my-way`) resolves an absolute-form target to its path before matching, so the route handler is dispatched normally. Two places on the middleware side matched against the **raw** request target instead: 1. The bundled copy of the `@fastify/middie` engine at `packages/platform-fastify/adapters/middie/fastify-middie.ts`. NestJS carried this fork to apply an earlier path-decoding fix and it did not track the upstream absolute-form fix released in `@fastify/middie@9.3.4`. 2. `FastifyAdapter`'s own re-check in `createMiddlewareFactory()`, which tests the middleware path regexp against `req.originalUrl`. Both normalized and percent-decoded the target, but neither resolved absolute-form to a path, so the router and the middleware layer disagreed about which path was being requested. A second, related defect contributed. Because the adapter always passes `routerOptions` (to install the version constraint), Fastify did not reflect the deprecated **top-level** router options (`ignoreTrailingSlash`, `ignoreDuplicateSlashes`, `caseSensitive`, `useSemicolonDelimiter`) in `initialConfig.routerOptions`, which is what the middleware engine reads. Applications passing those options at the top level had middleware normalize paths differently from the router, which widened the mismatch. ### Proof of concept ```ts @Controller('users') export class UsersController { @Get() findAll() { return 'protected data'; } } @Module({ controllers: [UsersController] }) export class AppModule implements NestModule { configure(consumer: MiddlewareConsumer) { consumer .apply((req, res) => res.end('blocked by auth middleware')) .forRoutes({ path: 'users', method: RequestMethod.GET }); } } ``` `supertest` and `light-my-request` always emit origin-form targets, so the request has to be written to the socket: ```js const { connect } = require('node:net'); const socket = connect(3000, '127.0.0.1', () => { socket.write( 'GET http://127.0.0.1:3000/users HTTP/1.1\r\n' + 'Host: 127.0.0.1:3000\r\n' + 'Connection: close\r\n\r\n', ); }); socket.pipe(process.stdout); ``` Observed on an affected version: `protected data` — the middleware did not run. Expected, and observed on a patched version: `blocked by auth middleware`. ### Patches Fixed in **12.0.2** and **11.2.4**. Upgrading to **12.0.3** or **11.2.5** is recommended. - The bundled `@fastify/middie` fork was removed and the package now depends on `@fastify/middie@9.3.4`, which resolves absolute-form targets before matching. - The adapter resolves absolute-form targets in its own route check, mirroring `find-my-way`. - Deprecated top-level Fastify router options are folded into `routerOptions` so the middleware engine and the router normalize paths identically. ### Workarounds If you cannot upgrade, reject non-origin-form request targets before middleware runs. Register the hook on the Fastify instance **before the application is initialized**, so that it runs ahead of the middleware engine's own `onRequest` hook, and confirm with the request above that the rejection takes effect: ```ts const adapter = new FastifyAdapter(); adapter.getInstance().addHook('onRequest', (request, reply, done) => { const target = request.raw.url ?? ''; // "*" is the legitimate request target of "OPTIONS * HTTP/1.1" if (target[0] !== '/' && target !== '*') { reply.code(400).send(); return; } done(); }); ``` Rejecting or normalizing absolute-form targets at a reverse proxy in front of the application is equally effective. ### Credit Reported by ZeroVuln Labs.

GHSA-9c5c-9qcx-q35q Affected @nestjs/platform-fastify Versions

2 component(s)
Fixed Versions:
11.2.412.0.2
Product / Package Ecosystem Affected Versions Fixed Version
@nestjs/platform-fastify
npm
< 11.2.4
11.2.4
@nestjs/platform-fastify
npm
≥ 12.0.0
< 12.0.2
12.0.2

References

Frequently Asked Questions

What is GHSA-9c5c-9qcx-q35q?
GHSA-9c5c-9qcx-q35q is a security vulnerability in @nestjs/platform-fastify involving Path-scoped middleware bypass via absolute-form request targets under CWE-436: Interpretation Conflict.
Which @nestjs/platform-fastify versions are affected?
Affected versions include releases prior to 11.2.4, 12.0.2 across affected packages: @nestjs/platform-fastify.
What version fixes GHSA-9c5c-9qcx-q35q?
Upgrading to 11.2.4, 12.0.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @nestjs/platform-fastify affected?
Yes, @nestjs/platform-fastify is affected in releases prior to 11.2.4, 12.0.2. Upgrade your dependency to 11.2.4, 12.0.2 or later.
What is the CVSS score of GHSA-9c5c-9qcx-q35q?
GHSA-9c5c-9qcx-q35q has a CVSS v3.1 base score of 7.4 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N.
What CWE is associated with GHSA-9c5c-9qcx-q35q?
GHSA-9c5c-9qcx-q35q is classified under CWE-436: Interpretation Conflict (Product A handles inputs or steps differently than Product B, which causes A to perform incorrect actions based on its perception of B's state.).
How can I check npm dependencies for GHSA-9c5c-9qcx-q35q?
Run the dependency tree command: 'npm ls @nestjs/platform-fastify'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-9c5c-9qcx-q35q",
  "modified" : "2026-09-30T14:41:39Z",
  "published" : "2026-09-30T14:41:39Z",
  "aliases" : [ ],
  "summary" : "@nestjs/platform-fastify: Path-scoped middleware bypass via absolute-form request targets",
  "details" : "| Field | Value |\n| --- | --- |\n| Ecosystem | npm |\n| Package | `@nestjs/platform-fastify` |\n| Affected versions | `>= 12.0.0, < 12.0.2` and `< 11.2.4` |\n| Patched versions | `12.0.2` and `11.2.4` (upgrade to `12.0.3` / `11.2.5`) |\n\n### Summary\n\nOn the Fastify adapter, an HTTP request that uses an **absolute-form request target** (`GET http://host/path HTTP/1.1`\ninstead of `GET /path HTTP/1.1`) reaches the route handler without running the path-scoped Nest middleware bound to\nthat route. Applications that enforce authentication or authorization in middleware execute the protected handler\nwith those checks skipped.\n\n### Impact\n\nAny application that\n\n- uses `@nestjs/platform-fastify`, and\n- binds middleware to specific paths via `MiddlewareConsumer.forRoutes(...)` or `.exclude(...)`, and\n- is reachable by a client that controls the raw request line.\n\nNode's HTTP server accepts absolute-form targets, so no special server configuration is needed. Exposure is reduced\nwhen a reverse proxy in front of the application rewrites the request target to origin-form, which most do.\n\nWhere the bypassed middleware performs authentication or authorization, the result is an authentication or\nauthorization bypass. Where it performs logging, rate limiting or body handling, those are silently skipped instead.\n\n### Details\n\nFastify's router (`find-my-way`) resolves an absolute-form target to its path before matching, so the route handler\nis dispatched normally. Two places on the middleware side matched against the **raw** request target instead:\n\n1. The bundled copy of the `@fastify/middie` engine at `packages/platform-fastify/adapters/middie/fastify-middie.ts`.\n   NestJS carried this fork to apply an earlier path-decoding fix and it did not track the upstream absolute-form fix\n   released in `@fastify/middie@9.3.4`.\n2. `FastifyAdapter`'s own re-check in `createMiddlewareFactory()`, which tests the middleware path regexp against\n   `req.originalUrl`.\n\nBoth normalized and percent-decoded the target, but neither resolved absolute-form to a path, so the router and the\nmiddleware layer disagreed about which path was being requested.\n\nA second, related defect contributed. Because the adapter always passes `routerOptions` (to install the version\nconstraint), Fastify did not reflect the deprecated **top-level** router options (`ignoreTrailingSlash`,\n`ignoreDuplicateSlashes`, `caseSensitive`, `useSemicolonDelimiter`) in `initialConfig.routerOptions`, which is what\nthe middleware engine reads. Applications passing those options at the top level had middleware normalize paths\ndifferently from the router, which widened the mismatch.\n\n### Proof of concept\n\n```ts\n@Controller('users')\nexport class UsersController {\n  @Get()\n  findAll() {\n    return 'protected data';\n  }\n}\n\n@Module({ controllers: [UsersController] })\nexport class AppModule implements NestModule {\n  configure(consumer: MiddlewareConsumer) {\n    consumer\n      .apply((req, res) => res.end('blocked by auth middleware'))\n      .forRoutes({ path: 'users', method: RequestMethod.GET });\n  }\n}\n```\n\n`supertest` and `light-my-request` always emit origin-form targets, so the request has to be written to the socket:\n\n```js\nconst { connect } = require('node:net');\n\nconst socket = connect(3000, '127.0.0.1', () => {\n  socket.write(\n    'GET http://127.0.0.1:3000/users HTTP/1.1\\r\\n' +\n      'Host: 127.0.0.1:3000\\r\\n' +\n      'Connection: close\\r\\n\\r\\n',\n  );\n});\nsocket.pipe(process.stdout);\n```\n\nObserved on an affected version: `protected data` — the middleware did not run.\nExpected, and observed on a patched version: `blocked by auth middleware`.\n\n### Patches\n\nFixed in **12.0.2** and **11.2.4**. Upgrading to **12.0.3** or **11.2.5** is recommended.\n\n- The bundled `@fastify/middie` fork was removed and the package now depends on `@fastify/middie@9.3.4`, which\n  resolves absolute-form targets before matching.\n- The adapter resolves absolute-form targets in its own route check, mirroring `find-my-way`.\n- Deprecated top-level Fastify router options are folded into `routerOptions` so the middleware engine and the\n  router normalize paths identically.\n\n### Workarounds\n\nIf you cannot upgrade, reject non-origin-form request targets before middleware runs. Register the hook on the\nFastify instance **before the application is initialized**, so that it runs ahead of the middleware engine's own\n`onRequest` hook, and confirm with the request above that the rejection takes effect:\n\n```ts\nconst adapter = new FastifyAdapter();\nadapter.getInstance().addHook('onRequest', (request, reply, done) => {\n  const target = request.raw.url ?? '';\n  // \"*\" is the legitimate request target of \"OPTIONS * HTTP/1.1\"\n  if (target[0] !== '/' && target !== '*') {\n    reply.code(400).send();\n    return;\n  }\n  done();\n});\n```\n\nRejecting or normalizing absolute-form targets at a reverse proxy in front of the application is equally effective.\n\n### Credit\n\nReported by ZeroVuln Labs.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@nestjs/platform-fastify"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "11.2.4"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@nestjs/platform-fastify"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "12.0.0"
      }, {
        "fixed" : "12.0.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/fastify/middie/security/advisories/GHSA-hx87-8wv7-pjv8"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nestjs/nest/security/advisories/GHSA-9c5c-9qcx-q35q"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nestjs/nest/pull/17737"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nestjs/nest/commit/5226fe084cf64b357de436f154bc89f2d319b621"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nestjs/nest/commit/dda252090ecb65009d9ff366444303796fc44fd7"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/nestjs/nest"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nestjs/nest/releases/tag/v11.2.4"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nestjs/nest/releases/tag/v12.0.2"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-288", "CWE-436" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-09-30T14:41:39Z",
    "nvd_published_at" : null
  }
}