Glossary

CSRF defined.

CSRF (Cross-Site Request Forgery) is an attack that tricks a logged-in user's browser into sending an unwanted request to a site they are authenticated with, using the session they already hold.

Definition

How a CSRF attack works

CSRF abuses the fact that browsers attach a site's cookies to every request to that site, including ones triggered from a different site. Suppose you are logged in to your bank and, in another tab, you visit a malicious page. That page can silently make your browser POST to the bank, and because your session cookie is sent automatically, the bank sees an authenticated request and acts on it, moving money or changing a setting you never asked for. The attack works precisely because the action depends on an ambient session the victim already holds.

The standard defenses break that assumption: a CSRF token, a secret value the real page embeds and the forged request cannot know, plus SameSite cookies and origin checks that reject requests coming from another site.

It is worth being clear about where this does and does not apply, which is exactly the case for a public form endpoint.

Related questions

Want to see it working?

Read the docs
Ready in a minute

Collect submissions on a safely public endpoint.

Free tier forever. No credit card required.