Courses

Advanced Server-Side Request Forgery (SSRF)
OSWE · Chapter 2

Advanced Server-Side Request Forgery (SSRF)

Advanced SSRF (Server-Side Request Forgery) goes beyond the basic "fetch this URL" case to cover bypasses of allow-lists and deny-lists — redirects, DNS rebinding, and alternate IP encodings that trick a server into requesting internal resources on the attacker's behalf.

Key concepts

  • Basic SSRF: an app fetches a user-supplied URL (e.g. a webhook or avatar-from-URL feature) without restriction, letting an attacker reach internal-only services.
  • Bypass techniques: redirect chains (the first request passes validation, the redirect target does not get re-validated), decimal/octal/hex IP encoding, and DNS rebinding after validation.
  • Cloud metadata endpoints (e.g. 169.254.169.254) are a classic high-value SSRF target for stealing instance credentials.
  • Best defense: allow-list destinations, disable following redirects in the HTTP client, and re-validate the resolved IP is not in a private range immediately before connecting (not just at input time).

Example

# Naive SSRF probe against a URL-fetching feature
curl "https://target/fetch?url=http://169.254.169.254/latest/meta-data/"

Try it yourself

In a lab SSRF challenge (PortSwigger Web Security Academy has several), try bypassing an IP-based deny-list using an alternate encoding of localhost (e.g. `0177.0.0.1` or `2130706433`).

@ Daniel Burlacu