Monitoring and Detection of SSRF Attempts
What you'll learn: How to track outbound requests and detect suspicious patterns that indicate Server-Side Request Forgery attacks.
Why Detection Matters
Even with strong prevention controls, monitoring outbound requests provides a critical safety net. Think of it like a building with locked doors (prevention) AND security cameras (detection)—you want both layers to catch threats you might have missed.
What to Log
Record every outbound HTTP request your application makes with rich context:
- Source: Which application component initiated the request
- Destination: Full URL, IP address, and port
- User context: Session ID or user identifier tied to the request
- Timestamp: When the request occurred
- Response codes: What came back (or if it failed)
This audit trail lets you reconstruct attack attempts and identify patterns.
Red Flags to Alert On
Configure alerts for suspicious behaviors:
Cloud metadata endpoints: Requests to 169.254.169.254, metadata.google.internal, or similar AWS/Azure/GCP services often signal SSRF reconnaissance.
Internal destinations: Outbound connections to RFC 1918 private ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) or localhost addresses when unexpected.
Unusual protocols: Attempts using file://, gopher://, dict:// instead of standard http/https.
High-frequency scanning: Rapid-fire requests to sequential IPs suggest enumeration attacks.
Known malicious patterns: URLs containing "../", encoded characters in unexpected places, or frequent DNS resolution failures.
Response Actions
When alerts trigger, your system should log detailed forensics, potentially block the source temporarily, and notify security teams for investigation—not just silently fail.
Key Takeaway: Logging outbound requests with full context and alerting on metadata endpoint access, internal destinations, and suspicious patterns transforms passive defenses into active threat detection for SSRF attacks.