Server-Side Request Forgery (SSRF)
A user-controlled URL turns the backend’s network position and credentials into an attacker-controlled capability.
Frame the problem
Security starts with a concrete asset, attacker capability and trust crossing.
Why the system fails
The fetcher accepts arbitrary destinations, follows redirects or resolves names into internal address space without enforcing a destination policy.
The important question is not “what is Server-Side Request Forgery (SSRF)?” but “which assumption let untrusted data or an over-scoped identity cross untrusted url → privileged server network?” Trace the decision at the boundary, then constrain what can happen after the first control fails.
Design the control in layers
Start with the control closest to the interpretation or privilege boundary: Avoid arbitrary fetching; allowlist destinations and protocols Then add a control that reduces blast radius and telemetry that proves the decision was enforced.
The resulting design is not labelled secure. Record the identified controls, the known failure paths, the remaining exposure, and the evidence you would need during an incident.
| Prevent | Detect | Recover |
|---|---|---|
| Avoid arbitrary fetching; allowlist destinations and protocols · Resolve and validate destination IPs across redirects · Restrict egress and protect metadata services | Connections to internal, link-local or unusual destinations · Fetcher responses inconsistent with expected media | Contain the affected identity or component, scope impact from audit evidence, and preserve a regression test. |
Key points
- Asset: Internal APIs, metadata services, cloud credentials and network trust.
- Boundary: Untrusted URL → privileged server network
- Primary control: Avoid arbitrary fetching; allowlist destinations and protocols
- Detection signal: Connections to internal, link-local or unusual destinations
- Always ask what limits damage when the primary control fails.
SSRF Network Boundary
Change the system and observe which assumption moves.
Follow the attack
Safe conceptual simulation: capability → missing control → crossed boundary → asset impact.
- 1Attacker starts with: A remote user who can ask the backend to fetch a URL.
- 2The fetcher accepts arbitrary destinations, follows redirects or resolves names into internal address space without enforcing a destination policy.
- 3The weak or missing boundary control is crossed: Untrusted URL → privileged server network
- 4Impact: Internal service access, credential exposure, data exfiltration or actions using the server identity.
- Internal service access, credential exposure, data exfiltration or actions using the server identity.
Defend, detect, recover
One prevention is a single point of security failure. Layer it and make failure observable.
- • Avoid arbitrary fetching; allowlist destinations and protocols
- • Resolve and validate destination IPs across redirects
- • Restrict egress and protect metadata services
- • Connections to internal, link-local or unusual destinations
- • Fetcher responses inconsistent with expected media
- • Contain the affected identity or component.
- • Scope access from audit evidence.
- • Fix the boundary and add a regression test.
- • Misconfiguration and new access paths can bypass the intended control.
- • A privileged insider or compromised control plane may still reach the asset.