Cross-site request forgery (CSRF) meaning, in plain words

CSRF tricks a logged-in user's browser into sending a request the user did not intend. How the attack works, what is at risk, and how tokens stop it.

Written by: Mio Kanzaki(Security Analyst (AI))Reviewed by: 千葉圭介Updated

Cross-site request forgery (CSRF) is an attack that causes a logged-in user's browser to send a request the user did not intend to make. IPA describes it as a vulnerability where a logged-in user is caused by a trap on an external site to send a request to the target site against the user's intent. If the site does not verify that a request was genuinely initiated by the user, the attack succeeds.

How does CSRF work?

Imagine a service desk that accepts any request from anyone who shows a membership card. A browser automatically attaches the Cookie — which acts like that membership card — to every request sent to a site the user is logged into. A trap page can cause the user's browser to send a request to that site, and the desk sees the right membership card attached and cannot tell the difference.

IPA notes that sites managing login state through Cookies are most exposed, and that financial operations such as payments or bank transfers carry the greatest potential harm when CSRF succeeds.

The primary defence is to attach a secret value to each request — a token — and verify it on the server. IPA describes this as the fundamental fix. OWASP also names token verification as the first option to implement. WordPress provides this mechanism under the name nonce. The technical details of checking for and addressing this flaw are on the CSRF vulnerability page.

Why does CSRF matter?

IPA lists the operations that are most at risk: unauthorized transfers, unintended purchases, account cancellation, and modification of information that only the logged-in user can change. This includes password changes and updates to admin screen settings. If an administrator is logged in and encounters a trap, the site's configuration could be altered without any action by the administrator.

Token checking is the core defence. IPA also names re-authentication as a fundamental option for high-value operations — asking for the password again immediately before an important action, and proceeding only on a correct answer. As a supplementary measure, sending a notification to the registered email address when an action occurs does not stop the attack but lets the user notice it quickly.

Two-factor authentication at login does not prevent CSRF. It checks identity at the login step, while CSRF uses a session that already exists after that step. Per-request verification is a separate requirement.

Whether your site verifies the origin of state-changing requests is not detectable from outside. The free URL check confirms what is externally visible. To discuss whether your forms and admin screens handle this, contact us.

Related terms

  • XSS: if an XSS flaw exists, it can undermine CSRF protections as well, because the token can be read by an injected script.
  • Clickjacking: a separate technique that also causes users to perform actions they did not intend.

Frequently asked questions

Does two-factor authentication prevent CSRF?

No. Two-factor authentication checks identity at the moment of login. CSRF uses a session that is already established after login. Per-request token verification is the fix for CSRF, and that is a separate mechanism.

What should a WordPress site do about CSRF?

Keep plugins and themes updated, and use the nonce mechanism WordPress provides when adding custom functionality. Components that have stopped receiving updates should be replaced.

Next step

The place to start is to check every form or admin-screen operation that makes a change, and confirm that each has a verification step. The CSRF vulnerability page covers what to look for and how to fix it. The free URL check shows what is visible from outside, and assessment enquiries can be directed to contact us.

Frequently asked questions

Does two-factor authentication prevent CSRF?

No. Two-factor authentication checks identity at the moment of login. CSRF uses a session that is already established after login. Per-request token verification is the fix for CSRF, and that is a separate mechanism.

What should a WordPress site do about CSRF?

Keep plugins and themes updated, and use the nonce mechanism WordPress provides when adding custom functionality. Components that have stopped receiving updates should be replaced.

See what an attacker can see, today

The free URL check returns a grade in under a minute. For costs and next steps, book a free consultation.