Pcornel
Security · Web Security

CSRF

Cheat sheet · https://pcornel.dk/topic.php?topic=4754

Back to the Topic

Answer

CSRF (cross-site request forgery) makes a logged-in user's browser send unwanted requests to a site. Anti-CSRF tokens, SameSite cookies and checking the Origin header prevent it.

Remember

  • Use anti-CSRF tokens on state-changing requests.
  • SameSite cookies block most CSRF.
  • Check the Origin header.

First checks

  • CSRF tokens on state-changing forms — present
  • SameSite cookie settings — defence
  • Origin/Referer checks — server validation

Verify in this order

attacker page → forged request → token/SameSite check rejects

Where it usually breaks

First mismatch in asset/subject identity → trust/authentication → authorization/policy → enforcement/control → telemetry/detection → protected outcome/response; preserve identity/policy/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=4754

Confirmation

Confirm action

Continue?