SSRF & Deserialization
Risks
Understand how Server-Side Request Forgery and insecure deserialization can compromise systems, and learn high-level mitigations to defend against them.
What is SSRF?
Server-Side Request Forgery (SSRF) is an attack where an adversary tricks a server into making HTTP requests to an unintended destination. Instead of the user fetching a resource, the server itself becomes the unwitting proxy, reaching internal services that should never be exposed.
How SSRF Works
What is Deserialization?
Serialization converts an in-memory object into a storable or transmittable format (bytes, JSON, XML). Deserialization reverses this, reconstructing the object from that format. If the incoming data is untrusted, an attacker can craft a malicious payload that executes code when the server rebuilds the object.
Insecure Deserialization Flow
Why These Risks Matter
Both SSRF and insecure deserialization appear in the OWASP Top 10, the industry standard list of the most critical web application security risks. They can lead to devastating outcomes even from a single vulnerable endpoint.
The SSRF Attack Surface
The Deserialization Attack Surface
SSRF vs Deserialization
| SSRF | Insecure Deserialization | |
|---|---|---|
| Attack Vector | Crafted URL / network request | Crafted serialized object |
| Who Acts | The server makes the request | The runtime rebuilds the object |
| Primary Impact | Access internal resources | Remote code execution |
| OWASP 2021 | A10: SSRF | A08: Software & Data Integrity |
| Data Flow | Network layer (HTTP/S, DNS) | Application layer (object parsing) |
Mitigating SSRF
Mitigating Deserialization
Example 1: Basic SSRF
Example 2: Java Deserialization
Example 3: SSRF Redirect Bypass
Common Mistakes
Defense Summary
| Defense Layer | SSRF | Deserialization |
|---|---|---|
| Input Validation | URL allowlisting | Integrity signatures (HMAC) |
| Network Controls | Block internal IPs, segmentation | Sandbox deserialization process |
| Architecture | DMZ, disable redirects | Use JSON/Protobuf instead |
| Runtime Protection | DNS re-resolution checks | Class allowlisting |
| Monitoring | Log outbound requests | Alert on deserialization errors |
Question 1 of 5
In an SSRF attack, which component is tricked into making the unauthorized request?
Question 2 of 5
Which of the following is the most effective defense against SSRF?
Question 3 of 5
Insecure deserialization is dangerous primarily because it can lead to:
Question 4 of 5
A developer switches from Java's native serialization to JSON for API communication. Which risk does this primarily mitigate?
Question 5 of 5
An attacker uses an external server that responds with a 302 redirect to bypass an SSRF allowlist. What mitigation would prevent this?