{"id":"GHSA-9c5c-9qcx-q35q","kind":"vulnerability","aliases":["GHSA-9c5c-9qcx-q35q"],"related":[],"title":"Path-scoped middleware bypass via absolute-form request targets","description":"| Field | Value |\r\n| --- | --- |\r\n| Ecosystem | npm |\r\n| Package | `@nestjs/platform-fastify` |\r\n| Affected versions | `>= 12.0.0, < 12.0.2` and `< 11.2.4` |\r\n| Patched versions | `12.0.2` and `11.2.4` (upgrade to `12.0.3` / `11.2.5`) |\r\n| Severity | High |\r\n| CVSS v3.1 | `AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N` (8.1) |\r\n| CWE | CWE-436 (Interpretation Conflict), CWE-288 (Authentication Bypass Using an Alternate Path or Channel) |\r\n\r\n### Summary\r\n\r\nOn the Fastify adapter, an HTTP request that uses an **absolute-form request target** (`GET http://host/path HTTP/1.1`\r\ninstead of `GET /path HTTP/1.1`) reaches the route handler without running the path-scoped Nest middleware bound to\r\nthat route. Applications that enforce authentication or authorization in middleware execute the protected handler\r\nwith those checks skipped.\r\n\r\n### Impact\r\n\r\nAny application that\r\n\r\n- uses `@nestjs/platform-fastify`, and\r\n- binds middleware to specific paths via `MiddlewareConsumer.forRoutes(...)` or `.exclude(...)`, and\r\n- is reachable by a client that controls the raw request line.\r\n\r\nNode's HTTP server accepts absolute-form targets, so no special server configuration is needed. Exposure is reduced\r\nwhen a reverse proxy in front of the application rewrites the request target to origin-form, which most do.\r\n\r\nWhere the bypassed middleware performs authentication or authorization, the result is an authentication or\r\nauthorization bypass. Where it performs logging, rate limiting or body handling, those are silently skipped instead.\r\n\r\n### Details\r\n\r\nFastify's router (`find-my-way`) resolves an absolute-form target to its path before matching, so the route handler\r\nis dispatched normally. Two places on the middleware side matched against the **raw** request target instead:\r\n\r\n1. The bundled copy of the `@fastify/middie` engine at `packages/platform-fastify/adapters/middie/fastify-middie.ts`.\r\n   NestJS carried this fork to apply an earlier path-decoding fix and it did not track the upstream absolute-form fix\r\n   released in `@fastify/middie@9.3.4`.\r\n2. `FastifyAdapter`'s own re-check in `createMiddlewareFactory()`, which tests the middleware path regexp against\r\n   `req.originalUrl`.\r\n\r\nBoth normalized and percent-decoded the target, but neither resolved absolute-form to a path, so the router and the\r\nmiddleware layer disagreed about which path was being requested.\r\n\r\nA second, related defect contributed. Because the adapter always passes `routerOptions` (to install the version\r\nconstraint), Fastify did not reflect the deprecated **top-level** router options (`ignoreTrailingSlash`,\r\n`ignoreDuplicateSlashes`, `caseSensitive`, `useSemicolonDelimiter`) in `initialConfig.routerOptions`, which is what\r\nthe middleware engine reads. Applications passing those options at the top level had middleware normalize paths\r\ndifferently from the router, which widened the mismatch.\r\n\r\n### Proof of concept\r\n\r\n```ts\r\n@Controller('users')\r\nexport class UsersController {\r\n  @Get()\r\n  findAll() {\r\n    return 'protected data';\r\n  }\r\n}\r\n\r\n@Module({ controllers: [UsersController] })\r\nexport class AppModule implements NestModule {\r\n  configure(consumer: MiddlewareConsumer) {\r\n    consumer\r\n      .apply((req, res) => res.end('blocked by auth middleware'))\r\n      .forRoutes({ path: 'users', method: RequestMethod.GET });\r\n  }\r\n}\r\n```\r\n\r\n`supertest` and `light-my-request` always emit origin-form targets, so the request has to be written to the socket:\r\n\r\n```js\r\nconst { connect } = require('node:net');\r\n\r\nconst socket = connect(3000, '127.0.0.1', () => {\r\n  socket.write(\r\n    'GET http://127.0.0.1:3000/users HTTP/1.1\\r\\n' +\r\n      'Host: 127.0.0.1:3000\\r\\n' +\r\n      'Connection: close\\r\\n\\r\\n',\r\n  );\r\n});\r\nsocket.pipe(process.stdout);\r\n```\r\n\r\nObserved on an affected version: `protected data` — the middleware did not run.\r\nExpected, and observed on a patched version: `blocked by auth middleware`.\r\n\r\n### Patches\r\n\r\nFixed in **12.0.2** and **11.2.4**. Upgrading to **12.0.3** or **11.2.5** is recommended.\r\n\r\n- The bundled `@fastify/middie` fork was removed and the package now depends on `@fastify/middie@9.3.4`, which\r\n  resolves absolute-form targets before matching.\r\n- The adapter resolves absolute-form targets in its own route check, mirroring `find-my-way`.\r\n- Deprecated top-level Fastify router options are folded into `routerOptions` so the middleware engine and the\r\n  router normalize paths identically.\r\n\r\n### Workarounds\r\n\r\nIf you cannot upgrade, reject non-origin-form request targets before middleware runs. Register the hook on the\r\nFastify instance **before the application is initialized**, so that it runs ahead of the middleware engine's own\r\n`onRequest` hook, and confirm with the request above that the rejection takes effect:\r\n\r\n```ts\r\nconst adapter = new FastifyAdapter();\r\nadapter.getInstance().addHook('onRequest', (request, reply, done) => {\r\n  const target = request.raw.url ?? '';\r\n  // \"*\" is the legitimate request target of \"OPTIONS * HTTP/1.1\"\r\n  if (target[0] !== '/' && target !== '*') {\r\n    reply.code(400).send();\r\n    return;\r\n  }\r\n  done();\r\n});\r\n```\r\n\r\nRejecting or normalizing absolute-form targets at a reverse proxy in front of the application is equally effective.\r\n\r\n### Credit\r\n\r\nReported by ZeroVuln Labs.","summary":"Sending a request line with an absolute-form target (such as GET http://host/path) makes the Fastify adapter skip path-scoped Nest middleware, though the route handler still runs. Applications that enforce authentication or authorization in that middleware can have those checks bypassed.","severity":"high","cvss":null,"epss":null,"exploited":false,"exploited_at":null,"products":[{"name":"@nestjs/platform-fastify","note":">= 12.0.0 < 12.0.2 and < 11.2.4","fixed":["12.0.2 and 11.2.4"],"affected":"","ecosystem":""}],"ecosystems":[],"tags":["cwe-288","cwe-436","fastify","nestjs","node","package","self-hosted"],"not_affected_if":["express-adapter","no-path-middleware","reverse-proxy-origin-form"],"how_to_check":"- Check the installed version of `@nestjs/platform-fastify` with `npm ls @nestjs/platform-fastify`; versions `>= 12.0.0` below `12.0.2` and versions below `11.2.4` are affected.\n- Look for `consumer.apply(...).forRoutes(...)` or `.exclude(...)` in NestModule `configure` methods that guard routes with auth.\n- Check whether a reverse proxy in front of the app rewrites request targets to origin-form.","fix":"- `@nestjs/platform-fastify` `12.0.2` for the 12.x line (the advisory recommends `12.0.3`)\n- `@nestjs/platform-fastify` `11.2.4` for the 11.x line (the advisory recommends `11.2.5`)\n- Workaround if upgrading is not possible: reject non-origin-form request targets in an onRequest hook registered before app initialization, or reject them at a reverse proxy.","status":"open","published_at":"2026-09-15T08:38:36+00:00","first_seen_at":"2026-11-09T22:53:18+00:00","triaged_at":"2026-11-09T23:01:28+00:00","updated_at":"2026-11-09T23:01:28+00:00","category":"package","confidence":0.9,"triage":{"at":"2026-11-09T23:01:28Z","model":"claude-haiku-5-5","output":{"fix":"- `@nestjs/platform-fastify` `12.0.2` for the 12.x line (the advisory recommends `12.0.3`)\n- `@nestjs/platform-fastify` `11.2.4` for the 11.x line (the advisory recommends `11.2.5`)\n- Workaround if upgrading is not possible: reject non-origin-form request targets in an onRequest hook registered before app initialization, or reject them at a reverse proxy.","reach":"internet","title":"NestJS Fastify adapter: path middleware skipped for absolute-form request targets","impact":"high","summary":"Sending a request line with an absolute-form target (such as GET http://host/path) makes the Fastify adapter skip path-scoped Nest middleware, though the route handler still runs. Applications that enforce authentication or authorization in that middleware can have those checks bypassed.","audience":"developers","category":"package","nicknames":[],"who_cares":["nestjs","fastify","node","self-hosted"],"confidence":0.9,"fix_status":"available","needs_auth":"no","worst_case":"Authentication middleware skipped, so protected handlers run without checks","analyst_note":"","how_to_check":"- Check the installed version of `@nestjs/platform-fastify` with `npm ls @nestjs/platform-fastify`; versions `>= 12.0.0` below `12.0.2` and versions below `11.2.4` are affected.\n- Look for `consumer.apply(...).forRoutes(...)` or `.exclude(...)` in NestModule `configure` methods that guard routes with auth.\n- Check whether a reverse proxy in front of the app rewrites request targets to origin-form.","plain_action":"","product_name":"","needs_analyst":false,"not_affected_if":["express-adapter","no-path-middleware","reverse-proxy-origin-form"],"who_is_affected":"Applications built on NestJS with the Fastify adapter that bind middleware to specific paths for authentication or authorization, and that accept raw HTTP requests from clients. Exposure is reduced when a reverse proxy rewrites request targets to origin-form, which most do. Apps not using the Fastify adapter, or not binding path-scoped middleware, can skip it.","user_interaction":"no","product_ecosystem":"","needs_special_setup":"no","severity_if_unknown":"high"},"cost_usd":0.001044,"input_tokens":6503,"output_tokens":788,"severity_before":"high"},"analyst_status":null,"analyst_note":null,"search":"'-288':24B,119C '-436':26B,115C '/path':150C '1':320C '11.2.4':89C,94C,585C '11.2.5':98C,590C '12.0.0':86C '12.0.2':87C,92C,583C '12.0.3':97C,588C '127.0.0.1':536C,539C,545C '2':357C '3000':535C,546C '3000/users':540C '8.1':112C '9.3.4':356C '9c5c':14A,19A '9qcx':15A,20A 'absolut':8A,41B,140C,218C,292C,350C,386C 'absolute-form':7A,40B,139C,217C,291C,349C,385C 'accept':216C 'adapt':51B,132C,412C 'affect':84C,560C 'altern':124C 'alway':413C,510C 'appli':335C,491C 'applic':64B,168C,186C,239C,445C 'appmodul':484C 'auth':497C,578C 'authent':67B,120C,171C,256C,263C 'author':69B,173C,258C,265C 'av':103C 'bind':191C 'block':495C,576C 'bodi':274C 'bound':164C 'bundl':322C 'bypass':5A,77B,121C,253C,266C 'carri':331C 'casesensit':434C 'channel':127C 'check':76B,182C,363C 'class':472C,483C 'client':205C 'close':550C 'concept':467C 'configur':225C,487C 'conflict':117C 'connect':528C,534C,549C 'const':527C,532C 'constraint':420C 'consum':488C,490C 'contribut':409C 'control':207C,469C,480C 'copi':323C 'createmiddlewarefactori':365C 'cvss':101C 'cwe':23B,25B,113C,114C,118C 'data':478C,563C 'decod':340C,379C 'defect':408C 'deprec':426C 'detail':281C 'differ':457C 'disagre':398C 'dispatch':305C 'earlier':337C 'ecosystem':80C 'emit':511C 'enforc':66B,170C 'engin':327C,443C 'exclud':199C 'execut':176C 'expect':569C 'export':471C,482C 'exposur':228C 'fastifi':27B,50B,131C,282C,421C 'fastify/middie':326C,355C 'fastifyadapt':358C 'field':78C 'find':286C 'find-my-way':285C 'findal':475C 'fix':341C,352C,581C 'fork':333C 'form':9A,42B,141C,219C,247C,293C,351C,387C,514C 'forrout':499C 'front':236C 'get':46B,144C,149C,474C,538C 'ghsa':13A,18A 'ghsa-9c5c-9qcx-q35q':12A,17A 'h/a':110C 'h/i':109C 'h/pr':105C 'handl':275C 'handler':61B,155C,179C,303C 'high':100C 'host':33B,544C 'host/path':47B,145C 'http':134C,214C 'http/1.1':146C,151C,541C 'ignoreduplicateslash':433C 'ignoretrailingslash':432C 'impact':184C 'implement':485C 'initialconfig.routeroptions':437C 'instal':417C 'instead':147C,280C,319C 'interpret':116C 'js':526C 'layer':397C 'level':429C,452C 'light':507C 'light-my-request':506C 'limit':272C 'line':37B,211C 'log':270C 'make':48B 'match':299C,313C 'method':502C 'middlewar':4A,57B,72B,163C,175C,192C,254C,311C,369C,396C,442C,454C,498C,565C,579C 'middlewareconsum':489C 'middlewareconsumer.forroutes':197C 'mismatch':464C 'modul':479C 'n':111C,543C,548C,552C,554C 'n/ac':104C 'n/s':107C 'n/ui':106C 'need':227C 'neither':383C 'nest':56B,162C 'nestj':28B,330C 'nestjs/platform-fastify':22A,83C,189C 'nestmodul':486C 'net':531C 'node':29B,212C,530C 'normal':306C,375C,455C 'npm':81C 'observ':557C,571C 'option':431C,448C 'origin':246C,513C 'origin-form':245C,512C 'packag':30B,82C 'packages/platform-fastify/adapters/middie/fastify-middie.ts':329C 'pass':414C,446C 'patch':90C,574C,580C 'path':2A,54B,125C,160C,195C,297C,339C,370C,390C,401C,456C,500C 'path-decod':338C 'path-scop':1A,53B,159C 'percent':378C 'percent-decod':377C 'perform':255C,269C 'place':308C 'process.stdout':556C 'proof':465C 'protect':178C,477C,562C 'proxi':234C 'q35q':16A,21A 'r':542C,547C,551C,553C 'rate':271C 'raw':209C,316C 're':362C 're-check':361C 'reach':152C 'reachabl':202C 'read':444C 'reduc':230C 'reflect':424C 'regexp':371C 'relat':407C 'releas':353C 'req':492C 'req.originalurl':373C 'request':10A,36B,135C,142C,210C,242C,317C,404C,509C,518C 'requestmethod.get':503C 'requir':529C 'res':493C 'res.end':494C 'resolv':289C,384C 'result':260C 'return':476C 'revers':233C 'rewrit':240C 'rout':60B,154C,167C,302C 'router':284C,393C,430C,460C 'routeropt':415C 'run':63B,157C,568C 'scope':3A,55B,161C 'second':406C 'self':32B 'self-host':31B 'send':34B 'server':215C,224C 'sever':99C 'side':312C 'silent':278C 'skip':52B,183C,279C 'socket':525C,533C 'socket.pipe':555C 'socket.write':537C 'special':223C 'specif':194C 'still':62B 'summari':128C 'supertest':504C 'target':11A,43B,143C,220C,243C,294C,318C,381C,515C 'test':367C 'though':58B 'top':428C,451C 'top-level':427C 'track':346C 'ts':468C 'two':307C 'u/c':108C 'upgrad':95C,586C 'upstream':348C 'use':122C,137C,188C 'user':470C,501C 'userscontrol':473C,481C 'usesemicolondelimit':435C 'v3.1':102C 'valu':79C 'version':85C,91C,419C,561C,575C 'via':6A,196C 'way':288C 'widen':462C 'without':156C 'written':522C","nicknames":[],"mitigations":[],"who_affected":"Applications built on NestJS with the Fastify adapter that bind middleware to specific paths for authentication or authorization, and that accept raw HTTP requests from clients. Exposure is reduced when a reverse proxy rewrites request targets to origin-form, which most do. Apps not using the Fastify adapter, or not binding path-scoped middleware, can skip it.","tier":"B","verified":{},"analyst_revisit_at":null,"fix_status":"available","audience":"developers","plain_action":null,"pkeys":["platformfastify"],"ptokens":["fastify","nestjs","platform"],"labels":["cwe288","cwe436","fastify","high","nestjs","node","package","selfhosted"],"campaign_type":null,"search_a":"'9c5c':14A,19A '9qcx':15A,20A 'absolut':8A 'absolute-form':7A 'bypass':5A 'form':9A 'ghsa':13A,18A 'ghsa-9c5c-9qcx-q35q':12A,17A 'middlewar':4A 'nestjs/platform-fastify':22A 'path':2A 'path-scop':1A 'q35q':16A,21A 'request':10A 'scope':3A 'target':11A 'via':6A","search_b":"'-288':24B '-436':26B 'absolut':41B 'absolute-form':40B 'adapt':51B 'applic':64B 'authent':67B 'author':69B 'bypass':77B 'check':76B 'cwe':23B,25B 'enforc':66B 'fastifi':27B,50B 'form':42B 'get':46B 'handler':61B 'host':33B 'host/path':47B 'line':37B 'make':48B 'middlewar':57B,72B 'nest':56B 'nestj':28B 'node':29B 'packag':30B 'path':54B 'path-scop':53B 'request':36B 'rout':60B 'run':63B 'scope':55B 'self':32B 'self-host':31B 'send':34B 'skip':52B 'still':62B 'target':43B 'though':58B","search_c":"'-288':119C '-436':115C '/path':150C '1':320C '11.2.4':89C,94C,585C '11.2.5':98C,590C '12.0.0':86C '12.0.2':87C,92C,583C '12.0.3':97C,588C '127.0.0.1':536C,539C,545C '2':357C '3000':535C,546C '3000/users':540C '8.1':112C '9.3.4':356C 'absolut':140C,218C,292C,350C,386C 'absolute-form':139C,217C,291C,349C,385C 'accept':216C 'adapt':132C,412C 'affect':84C,560C 'altern':124C 'alway':413C,510C 'appli':335C,491C 'applic':168C,186C,239C,445C 'appmodul':484C 'auth':497C,578C 'authent':120C,171C,256C,263C 'author':173C,258C,265C 'av':103C 'bind':191C 'block':495C,576C 'bodi':274C 'bound':164C 'bundl':322C 'bypass':121C,253C,266C 'carri':331C 'casesensit':434C 'channel':127C 'check':182C,363C 'class':472C,483C 'client':205C 'close':550C 'concept':467C 'configur':225C,487C 'conflict':117C 'connect':528C,534C,549C 'const':527C,532C 'constraint':420C 'consum':488C,490C 'contribut':409C 'control':207C,469C,480C 'copi':323C 'createmiddlewarefactori':365C 'cvss':101C 'cwe':113C,114C,118C 'data':478C,563C 'decod':340C,379C 'defect':408C 'deprec':426C 'detail':281C 'differ':457C 'disagre':398C 'dispatch':305C 'earlier':337C 'ecosystem':80C 'emit':511C 'enforc':170C 'engin':327C,443C 'exclud':199C 'execut':176C 'expect':569C 'export':471C,482C 'exposur':228C 'fastifi':131C,282C,421C 'fastify/middie':326C,355C 'fastifyadapt':358C 'field':78C 'find':286C 'find-my-way':285C 'findal':475C 'fix':341C,352C,581C 'fork':333C 'form':141C,219C,247C,293C,351C,387C,514C 'forrout':499C 'front':236C 'get':144C,149C,474C,538C 'h/a':110C 'h/i':109C 'h/pr':105C 'handl':275C 'handler':155C,179C,303C 'high':100C 'host':544C 'host/path':145C 'http':134C,214C 'http/1.1':146C,151C,541C 'ignoreduplicateslash':433C 'ignoretrailingslash':432C 'impact':184C 'implement':485C 'initialconfig.routeroptions':437C 'instal':417C 'instead':147C,280C,319C 'interpret':116C 'js':526C 'layer':397C 'level':429C,452C 'light':507C 'light-my-request':506C 'limit':272C 'line':211C 'log':270C 'match':299C,313C 'method':502C 'middlewar':163C,175C,192C,254C,311C,369C,396C,442C,454C,498C,565C,579C 'middlewareconsum':489C 'middlewareconsumer.forroutes':197C 'mismatch':464C 'modul':479C 'n':111C,543C,548C,552C,554C 'n/ac':104C 'n/s':107C 'n/ui':106C 'need':227C 'neither':383C 'nest':162C 'nestj':330C 'nestjs/platform-fastify':83C,189C 'nestmodul':486C 'net':531C 'node':212C,530C 'normal':306C,375C,455C 'npm':81C 'observ':557C,571C 'option':431C,448C 'origin':246C,513C 'origin-form':245C,512C 'packag':82C 'packages/platform-fastify/adapters/middie/fastify-middie.ts':329C 'pass':414C,446C 'patch':90C,574C,580C 'path':125C,160C,195C,297C,339C,370C,390C,401C,456C,500C 'path-decod':338C 'path-scop':159C 'percent':378C 'percent-decod':377C 'perform':255C,269C 'place':308C 'process.stdout':556C 'proof':465C 'protect':178C,477C,562C 'proxi':234C 'r':542C,547C,551C,553C 'rate':271C 'raw':209C,316C 're':362C 're-check':361C 'reach':152C 'reachabl':202C 'read':444C 'reduc':230C 'reflect':424C 'regexp':371C 'relat':407C 'releas':353C 'req':492C 'req.originalurl':373C 'request':135C,142C,210C,242C,317C,404C,509C,518C 'requestmethod.get':503C 'requir':529C 'res':493C 'res.end':494C 'resolv':289C,384C 'result':260C 'return':476C 'revers':233C 'rewrit':240C 'rout':154C,167C,302C 'router':284C,393C,430C,460C 'routeropt':415C 'run':157C,568C 'scope':161C 'second':406C 'server':215C,224C 'sever':99C 'side':312C 'silent':278C 'skip':183C,279C 'socket':525C,533C 'socket.pipe':555C 'socket.write':537C 'special':223C 'specif':194C 'summari':128C 'supertest':504C 'target':143C,220C,243C,294C,318C,381C,515C 'test':367C 'top':428C,451C 'top-level':427C 'track':346C 'ts':468C 'two':307C 'u/c':108C 'upgrad':95C,586C 'upstream':348C 'use':122C,137C,188C 'user':470C,501C 'userscontrol':473C,481C 'usesemicolondelimit':435C 'v3.1':102C 'valu':79C 'version':85C,91C,419C,561C,575C 'via':196C 'way':288C 'widen':462C 'without':156C 'written':522C","cause_entry":null,"cause_path":null,"disclosures_checked_at":null,"first_public_at":"2026-09-15T08:38:36+00:00","kev":null,"cvss_vector":null,"cvss_by":null,"poc_count":0,"sources":[{"source":"ghsa-repo","external_id":"GHSA-9c5c-9qcx-q35q","url":"https://github.com/nestjs/nest/security/advisories/GHSA-9c5c-9qcx-q35q","severity":"high","published_at":"2026-09-15T08:38:36+00:00","modified_at":"2026-09-15T08:38:36+00:00","first_seen_at":"2026-11-09T22:53:18+00:00","fetched_at":"2026-11-09T22:53:18+00:00","note":null}],"documents":[{"id":110471,"url":"https://github.com/nestjs/nest/security/advisories/GHSA-9c5c-9qcx-q35q","title":"Maintainer's advisory: github.com","kind":"vendor","source":"ghsa-repo","publisher":"vendor","text":null,"published_at":null,"relation":"advisory","confidence":null,"note":"Maintainer's advisory: github.com"}],"disclosures":[],"exploit_sources":[],"notice":"Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai"}