The short answer: CSRF makes a logged-in victim’s browser send a forged request to your site, riding on their cookies. SSRF makes your server send a request to a destination the attacker picks, riding on its network access. CSRF abuses the user’s session; SSRF abuses the server’s position inside your network.
CSRF (Cross-Site Request Forgery) SSRF (Server-Side Request Forgery) Who sends the forged request The victim’s browser Your application server Whose trust is abused The site’s trust in the user’s cookies The network’s trust in the server What the attacker needs A logged-in victim to visit their page Any input the server turns into a URL fetch Typical target A state-changing endpoint (POST /transfer, /email/change) Internal hosts, cloud metadata (169.254.169.254), localhost admin ports Attacker sees the response? No, the browser’s same-origin policy hides it Sometimes (full-read SSRF); often blind Worst case Actions taken as the victim: account takeover, transfers Cloud credential theft, internal network access, sometimes RCE Primary defenses CSRF tokens, SameSite cookies, Origin checks Destination allowlist, resolved-IP checks, egress filtering, IMDSv2 CWE CWE-352 CWE-918 OWASP Top 10 Under A01 Broken Access Control A10:2021; merged into A01 in the 2025 list They both have “request forgery” in the name, so people lump them together. But they’re completely different beasts that’ll bite you in completely different ways, and the defense for one does nothing for the other. I’ve spent way too many nights debugging both, so here’s the side-by-side first, then the detail.
...