Block server-side request forgery in URL-fetching features
8 steps · about 2 h 20 min · Intermediate
- What server-side request forgery is (reference, OWASP, 10 min)
See which everyday features, such as link previews, webhooks and image imports, let an attacker steer your server's requests.
- Reach internal services through a vulnerable fetch (interactive, PortSwigger Web Security Academy, 35 min)
Work through the explanation and first labs to watch a harmless-looking URL field reach an internal admin page.
- Detect blind request forgery (article, PortSwigger Web Security Academy, 15 min)
Many real cases return nothing to the attacker; learn how out-of-band callbacks reveal them so you test for them too.
- The API view: webhooks and integrations (reference, OWASP API Security, 10 min)
Map the risk onto API features that accept callback URLs and see which conditions make an endpoint exploitable.
- Why naive URL filters fail (reference, PortSwigger, 15 min)
Scan the encodings and redirect tricks that defeat string matching, so you validate the resolved address rather than the text.
- Layered defences for URL fetching (guide, OWASP Cheat Sheet Series, 25 min)
Choose between allow-lists and block-lists, disable redirects, and add network-level isolation for the fetching component.
- Check resolved addresses against private ranges (doc, Python documentation, 15 min)
Use a standard library to classify a resolved IP as private, loopback or link-local before connecting, instead of hand-written patterns.
- Require token-based cloud metadata access (doc, AWS documentation, 15 min)
Close the classic credential-theft target by enforcing IMDSv2, so a forged request cannot simply read instance keys.