Server-side request forgery: fetchers, internal targets, and allow-lists that hold
How features that fetch a URL — webhooks, previews, importers, PDF renderers — can be pointed at internal services, how testers confirm SSRF safely with a canary host, and how to build an allow-list that survives redirects and DNS tricks.
Diagram
A fetcher reaching the wrong network
Step 1 of 4
Feature
A user supplies a URL for a webhook, avatar import, or link preview.
POST /api/webhooks
{"url": "https://hooks.partner.example/notify"}Block localhost and a few ranges
Alternate encodings, DNS rebinding, redirects
Endless
The example on the open step is one illustration, or the fix you can paste into an application you own.
What this page is made of
3 pieces. Each one says what fails, who is affected, what you would notice, and what you change.
Where fetchers hide
- What fails
- Webhooks, URL previews, image importers, PDF and HTML renderers, and XML parsers all make server-side requests.
- Who is affected
- Internal services and anything the cloud instance role can access.
- What you would notice
- A feature that accepts a URL and shows a preview or status.
- What you change
- Inventory every outbound fetch and route them through one guarded client.
Cloud metadata
- What fails
- Instance metadata services hand out credentials to whatever can reach them from the instance.
- Who is affected
- The whole cloud account, through the instance role.
- What you would notice
- Instances still allowing IMDSv1 or containers that can reach the node’s metadata address.
- What you change
- Require IMDSv2 tokens, set hop limit to 1, and scope instance roles narrowly.
Redirects and DNS
- What fails
- A checked URL can redirect, or its DNS can change between the check and the fetch.
- Who is affected
- The same internal targets, past a naive check.
- What you would notice
- Validation on the URL string only, with redirects followed automatically.
- What you change
- Resolve once, connect to that address, and disable or re-validate redirects.
Confirming it safely
In an authorized test, point the feature at a canary host you control, such as a request-catcher service or your own server, and check whether a request arrives from the application’s address. That proves the server fetches attacker-chosen URLs without touching internal systems. Reaching internal targets should only happen if the scope explicitly allows it.
# your canary server log 203.0.113.80 - - [03/Nov/2026:10:12:44 +0000] "GET /hb-ssrf-7731 HTTP/1.1" 404 "-" "AppFetcher/2.3" -> the application fetched a URL we supplied; report the parameter
Egress as the real control
Put fetchers in a network segment whose only route out is an egress proxy with an allow-list. Then even a parser bug that fetches a URL cannot reach internal ranges. Log every proxied request with the feature name.
Related pages
The metadata and link-local page covers cloud credential exposure, and the redirect hop checks page covers validation across redirects.
Check yourself
Recognition and the fix. Nothing here is a procedure.
What is the safest way to confirm SSRF during an authorized test?
Go deeper
Specific techniques, exercises, and glossary cards for this topic.
- 01Metadata and link-local fetchesA server that fetches a caller-influenced address can reach link-local services, including a cloud metadata endpoint the caller cannot open from their own machine. Includes the diagram and a defensive fix.
- 02Checking every hop of a server-side fetchAn allow-list that only looks at the first URL loses when that host redirects the server somewhere else. Includes the diagram and a defensive fix.
Exercises
- 01Evidence deskRead a query review and a server-side fetch that were already collected. Name the failure and the fix.
- 02SSRF allowlist evaluatorAn image import feature fetches URLs on the server. Combine host matching, address checks, redirect checks, and pinning until nine test URLs behave.
- 03Terminal mission: From a thumbnail service to the order exportsA pod that fetches image URLs was used to read the node’s cloud credentials. Follow it from kubectl logs into CloudTrail and measure what the stolen role reached from outside.