Web SecurityWeb Security · Lesson 08
CSRF, SSRF & Open Redirect
Forged requests, server-side request forgery and unsafe redirects.
Video tutorialTrack course · freeCodeCamp
Speed
Transcript & captions
5/5
CSRF tricks a logged-in victim's browser into sending a state-changing request. SSRF tricks the server into making a request on the attacker's behalf - often to internal services the attacker cannot reach.
| Bug | Defence |
|---|---|
| CSRF | SameSite cookies, anti-CSRF tokens, re-auth on sensitive actions |
| SSRF | Allowlist destinations, block private IP ranges and metadata endpoints |
| Open redirect | Only redirect to relative paths or an allowlist |
| Clickjacking | frame-ancestors 'none' or X-Frame-Options DENY |
SSRF against cloud metadata services can expose instance credentials - treat any user-supplied URL that the server fetches as high risk.
Knowledge check
0/2 answeredSameSite cookies primarily mitigate...
SSRF means the request is made by...