SSRF Filter Bypass Techniques
What you'll learn: How attackers evade SSRF protections by disguising malicious URLs through encoding tricks, DNS manipulation, and parser confusion.
The Challenge
When developers implement SSRF defenses, they often use allowlists (permitted domains) or blocklists (forbidden addresses like localhost or 169.254.169.254). Attackers have developed clever techniques to bypass these filters by exploiting how URLs are parsed and resolved.
Core Bypass Techniques
IP Encoding Variations
Filters may block 127.0.0.1, but accept alternative representations:
- Decimal:
2130706433(the numeric equivalent) - Octal:
0177.0.0.1or0177.01 - Hexadecimal:
0x7f.0x0.0x0.0x1 - Mixed formats:
127.1(shorthand for127.0.0.1)
These all resolve to localhost but may slip past string-based filters.
DNS Rebinding
An attacker controls a DNS record that initially resolves to an allowed IP (passing the allowlist check), then quickly changes to an internal IP (like 127.0.0.1) before the actual request occurs. The filter sees one thing; the request targets another.
Open Redirects
If an allowed domain has a redirect vulnerability, attackers can chain it: https://trusted-site.com/redirect?url=http://169.254.169.254/metadata. The filter sees the trusted domain, but the final request hits the cloud metadata service.
Parser Differentials
Different URL parsers may interpret the same string differently. For example: https://expected-host@internal-host/ might be read as "username expected-host at domain internal-host" by the application but parsed differently by the filter.
Why It Works
These bypasses exploit the gap between validation logic and execution logic—the code that checks the URL uses different parsing rules than the code that fetches it.
Key Takeaway: SSRF filters can be bypassed through IP encoding tricks, DNS rebinding attacks, redirect chaining, and exploiting differences in how various components parse URLs—defenders must validate using the same parser that performs the request.