cross-site request forgery
An attack where another website makes a logged-in user’s browser send an unwanted request that carries their cookies automatically.
It lets an attacker act as a logged-in user without stealing their credentials.
In more detail
Because browsers attach cookies by themselves, a cookie-based session can be abused from a hostile page. SameSite cookies, anti-forgery tokens and refusing state changes on GET are the usual defences; bearer tokens in a header are not sent automatically.
Related terms
- SameSite — A cookie attribute that limits whether the browser sends the cookie on requests started by other websites.
- cookie — A small named value a server asks a browser to store and send back automatically on later matching requests.
- session — A record the server keeps about a logged-in caller, found on each request through a handle the client presents, usually in a cookie.
- Server Functions — Async functions marked with "use server" that run on the server but can be called from client components, for example as a form action.
Taught in
- Cookies And CORS — Modern API Architecture: REST, GraphQL & gRPC
- Server Actions: use server Directives & Mutations — Next.js 15 & Modern App Router Architecture
- Session Management: Secure Cookies & Token Validation — Next.js 15 & Modern App Router Architecture