Logic Foundry

Build with understanding.

SSRF in Flask, Django and Next.js: Check the Request Path, Not Just the URL

A November 12, 2026, analysis of server-side request forgery (SSRF) examines how user-controlled URLs can reach network requests in Flask, Django and Next.js applications. Its most useful lesson is an application-level one: validate and constrain the destination at the point where the server makes the request, including after any redirect. The examples do not establish a vulnerability in each framework by default.

In the Flask example, a route passes a query parameter directly to requests.get() and then gives the response bytes to Pillow for image processing. The network request happens in requests.get(), not in Pillow. If the application accepts an arbitrary URL, the server may contact an unintended HTTP endpoint before image decoding begins. The article also illustrates how an allowed initial URL could redirect to a disallowed destination.

The Django example requires a different distinction. A view returning HttpResponseRedirect sends a redirect to the client; that code alone does not make a server-side request. The article alleges that a CRLF-based response-splitting chain could produce an SSRF under particular proxy behavior and reports roughly 68% success in a Django 4.2, Gunicorn and Nginx test setup. It does not provide enough test detail to treat that figure or the proposed chain as a general Django behavior. Its separate example of fetching an external API URL is an SSRF risk if that API base URL is user-controlled.

In Next.js, the clearest risk is an application’s server-side code calling fetch() with a URL taken directly from a request. The article discusses getServerSideProps and remote images, but those paths need to be assessed separately: rendering an <Image> component is not, by itself, evidence that arbitrary remote hosts are permitted. The article’s getServerSideProps snippet is a Pages Router example, not an App Router implementation.

For a practical review, trace every user-controlled value that can become an outbound destination. Prefer server-side IDs mapped to approved URLs over accepting arbitrary links. Where remote requests are necessary, allow only required schemes and destinations, check resolved addresses and each redirect target, set timeouts, and restrict outbound network access. Centralizing requests in one service layer makes those checks and their audit logs easier to apply consistently.