Skip to content
BENIBIX Learn

SSRF vs CSRF

People think SSRF and CSRF are the same trick because the names sound alike, and they are not. In CSRF, the attacker gets your browser to send a request to a site you are logged in to. In SSRF, the attacker gets the server itself to send the request. Often it goes to a private address inside the server's own network.

Development🔐 Security

Server-Side Request Forgery (SSRF)

Making a server fetch a link of the attacker's choice. Often it is a private one.

SSRF tricks a server into making a web request for the attacker. The app fetches a link the user gives, say to show a preview. The attacker gives a link to an inside address instead. The server can reach places the attacker cannot, like private admin pages or cloud settings. So the reply leaks secrets. The fix is to fetch only from a fixed list of places.

Example
An app makes a preview of any link. An attacker pastes a private address from inside the company, and the preview shows an admin page.
Why it matters
Cloud servers can often reach secret keys through inside addresses. SSRF can hand those keys to a stranger.
Full entry
Development🔐 Security

Cross-Site Request Forgery (CSRF)

An attack that tricks your browser. It sends a request you never meant to send.

Cross-site request forgery tricks your browser into sending a request. You are logged in to your bank in one tab. A bad page in another tab quietly sends a form to the bank. Your browser adds your login cookie, so the bank thinks it was you. The fix is a secret token on every form, plus cookies marked SameSite.

Example
Jack is logged in to his shop admin. He opens a link from an email, and a hidden form on that page changes his account email to the attacker's.
Why it matters
It turns your own login against you. Any action a user can do by a click can be forged this way.
Full entry

In one line

Server-Side Request Forgery (SSRF)
Making a server fetch a link of the attacker's choice. Often it is a private one.
Cross-Site Request Forgery (CSRF)
An attack that tricks your browser. It sends a request you never meant to send.