Web injection and scripting
Cross-site request forgery
Making a victim's browser send a state-changing request to a site they are logged in to, from a page the attacker controls.
Cross-site request forgery (CSRF) makes a victim's browser send a state-changing request to a site they are logged into, from the attacker's page. The browser attaches the site's cookies, so the site accepts it. The attacker never sees the cookie or the response. SameSite=Lax keeps the cookie off cross-site POSTs, but a top-level GET navigation carries it. The fix: an anti-CSRF token on every state change, and none on GET.
Read next
- Cross-site scripting Getting a web app to serve your JavaScript to other users, so it runs in their browser as the site itself.
- Broken access control An access check that rests on something the client controls, so an attacker simply sets it and walks past.
- HTTP The web's request and response protocol: plain text over TCP unless wrapped in TLS.