Skip to content
SSRF Write-up Beginner

️ When an Image Loader Turned Into a Backdoor: My Discovery of

The Next.js image optimization endpoint accepted an arbitrary URL and made a server-side request to it, allowing an attacker to trigger outbound requests from the backend. This blind SSRF could be used to scan internal networks or access cloud metadata endpoints.

Anshubind Follow

Published on medium.com

Sometimes the most dangerous vulnerabilities hide behind the most harmless-looking parameters. And in this case, it wasn’t an admin panel, a misconfigured server, or an exposed endpoint.

Anshubind, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the image optimization endpoint did not validate or restrict the URL parameter, allowing requests to arbitrary hosts including internal addresses.

Impact

An attacker could use the server to make requests to internal services and cloud metadata endpoints, potentially leaking credentials or enabling further attacks.

What the attacker needed

Access to the public explorer; a listener to receive requests

The fix

The endpoint should be fixed by allow-listing trusted image domains and rejecting or sanitizing user-controlled URL values, including blocking private IP ranges and metadata endpoints.

How it was found

  1. Identify the Next.js image optimization endpoint.
  2. Replace the image URL parameter with a Burp Collaborator domain.
  3. Send the request and observe the Collaborator interaction.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

The website had a feature that fetched images from other websites for you. The problem was it did not check which websites it was told to fetch from, so someone could make the server visit any address, including private ones inside the company network. This is called server-side request forgery (SSRF): the server is tricked into making requests on the attacker's behalf.

What is SSRF?

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.

More by Anshubind

View all

15 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Server-side request forgery (SSRF)

The lesson behind this report.

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.