Security & DevSecOps Practical By Samson Tanimawo, PhD Published Oct 12, 2025 4 min read

SSRF Protection Patterns

Server-side request forgery. The defenses.

Validate URLs

Server-Side Request Forgery (SSRF) is the vulnerability where an attacker tricks a server into making HTTP requests to destinations the attacker chose, including internal services that are not normally reachable from outside. SSRF was the vector for the Capital One breach and many others; it is the bug that "pull this URL for me" features keep introducing. The defense is layered, starting with code-level URL validation.

What URL validation actually requires:

Code-level validation is the first line of defense and the cheapest. Most SSRF bugs would have been caught by a simple "is this URL on the allowlist" check at the right layer.

Network

Code-level validation is necessary but not sufficient. Code has bugs. The attacker has unlimited time to find them. The second layer of defense is network-level: even if the application makes a request to an internal IP, the network refuses to deliver it.

Network-level enforcement catches the SSRF bugs that code-level validation missed. The two layers compound; the security posture is the product of both, not the sum.

IMDSv2

Cloud instance metadata services are the most common SSRF target on AWS. The metadata endpoint at 169.254.169.254 returns instance credentials, which an attacker can use to escalate from "I made you fetch a URL" to "I have your AWS credentials." The defense is IMDSv2, which fundamentally changes how the metadata service is accessed.

SSRF protection requires layered defenses: code-level URL validation, network-level egress filtering, and platform-specific protections like IMDSv2. Nova AI Ops audits the configuration of each layer, surfaces the cases where IMDSv1 is still allowed, and tracks egress traffic patterns to flag the application behavior that looks like SSRF in flight.