SSRF: when your server makes requests for the attacker

Server-side request forgery (SSRF) is an attack in which an application fetches a URL supplied by the user, and the attacker supplies one that points somewhere the application should never go: an internal admin page, a database, or a cloud provider's metadata service that hands out credentials. The request comes from your own server, so it passes firewalls that would stop the attacker directly.

Section Web attacks Updated Weakness CWE-918

Quick facts

Weakness
CWE-918: server-side request forgery
OWASP category
A01:2025 Broken Access Control, merged in from a separate 2021 category (A01 page)
Typical feature
Link previews, image fetch by URL, webhooks, PDF rendering, import from URL
Typical target
Internal services, admin interfaces and cloud metadata endpoints
Does a WAF stop it?
Partly. Internal addresses in a parameter are recognisable; redirects and DNS tricks are not

Definitions follow OWASP and CWE-918. Not to be confused with CSRF, which forges requests from the victim's browser.

How an SSRF attack works

  1. The application fetches a URL from input. To show a preview, download an image or call a webhook.
  2. The attacker supplies an internal address. A private range, localhost, or a name that resolves to one.
  3. The server makes the request. From inside the network, with whatever access the server has.
  4. The response comes back, or its effect does. The attacker reads the result directly, or infers it from timing and errors.

The server becomes a proxy into places the attacker cannot reach. In cloud environments, the most damaging target is usually the metadata service, which can return temporary credentials for the server's role.

Basic and blind SSRF

In basic SSRF the application returns the fetched content, so the attacker reads internal pages directly. In blind SSRF nothing is returned; the attacker learns from response times and error messages which addresses answer, or triggers actions on internal services that do not need a reply.

Blind SSRF is easy to dismiss and still dangerous: an internal endpoint that changes state on a simple request can be triggered without the attacker ever seeing the result.

WAYS AN INTERNAL TARGET SLIPS THROUGH VISIBLE IN THE REQUEST CAUGHT BY A HOST LIST CAUGHT BY CHECKING THE IP URL IN A PARAMETER REDIRECT FROM AN ALLOWED HOST NAME RESOLVING TO PRIVATE ADDRESS ALTERNATE IP NOTATION // check the address actually connected to, not the text
// four delivery tricks, and the one check that catches them all

SSRF examples in ordinary features

Link previews fetch a page to show its title and image; given an internal address, they fetch an internal page instead. Image import by URL downloads whatever the address returns. Webhooks call a URL the customer configured, which may be an internal one.

Document converters that render HTML into PDF are a quieter case: the HTML can include references the renderer fetches while drawing the page. Any feature that turns user-supplied addresses into server-side requests belongs on the list to review.

What a WAF catches, and what it misses

A filter can match obvious internal targets in a parameter: loopback, private ranges, metadata addresses. That catches careless attempts.

It misses what only becomes internal later: a public name that resolves to a private address, an allowed host that redirects inward, or an address written in an unusual notation. The decision has to be made at the moment the server connects, which is inside the application.

How to prevent SSRF

  1. Do not fetch arbitrary URLs. Where possible, allow only a fixed list of hosts the feature needs; the OWASP SSRF Prevention Cheat Sheet starts here.
  2. Check the resolved address before connecting. Refuse private, loopback, link-local and other special-purpose ranges listed in RFC 6890.
  3. Do not follow redirects blindly. Re-check every hop, or turn redirects off.
  4. Isolate the fetcher. Run URL fetching from a network segment that cannot reach internal services.
  5. Protect the metadata service. Use the cloud provider's hardened mode that requires a session token.

Questions

What is SSRF?

Server-side request forgery is an attack in which an application fetches a URL supplied by the user, and the attacker makes the server request internal systems or cloud metadata it should not reach.

What is the difference between SSRF and CSRF?

SSRF makes your server send requests the attacker chooses. CSRF makes a victim's browser send requests to your site the victim did not intend.

How do you prevent SSRF?

Allow only the hosts a feature needs, check the resolved address against private and special-purpose ranges before connecting, re-check redirects, isolate the fetching service, and harden the metadata service.

Which OWASP category is SSRF in?

In the OWASP Top 10:2025, server-side request forgery is part of A01 Broken Access Control; in 2021 it was a separate category.