The vulnerability lies in how Next.js handles WebSocket upgrade requests in self-hosted environments. An attacker could craft a special WebSocket upgrade request containing an absolute URL. The initialize function in packages/next/src/server/lib/router-server.ts was responsible for handling these upgrade requests. The analysis of the patch commit 5b194ee2d452744eb839856a670bdc33b03062c4 reveals that the upgrade event listener within the initialize function was vulnerable. Previously, the code only checked if the parsed URL from the request had a protocol. If it did, it would unconditionally proxy the request using proxyRequest. This allowed an attacker to force the server to make a request to an arbitrary internal or external service. The patch introduces additional checks on the result of resolveRoutes, specifically the finished and statusCode properties, to ensure that a request is only proxied if it corresponds to a legitimate and safe rewrite, thus mitigating the SSRF vulnerability.