Skip to content

Bug class · Beginner

Cross-site request forgery (CSRF)

Another site makes a signed-in user's browser perform an action they did not intend.

median public bounty
$500

Covers CWE 352.

How it works

Full lesson

The pattern behind every report in this class.

Cross-site request forgery is a class of bug where another site can make a logged-in user's browser send a state-changing request to a target application, and the application accepts it because it only checks the session cookie. The evidence behind this lesson covers 615 reports, 84 of which carry a summary, and 135 of which were paid, so this is a well-trodden area rather than a rare curiosity. Programs care because the actions that get forged are the ones that matter to users: changing an email address, resetting a password, deleting an account, linking a third-party login, or moving money-like state such as cart contents and invitations.

The usual consequence is account takeover. A forged email change followed by a password reset, a forged account-linking request, or a forged password change after a reset all hand the attacker the account. Where takeover is not reachable, the impact is still real: forced logout, unwanted follows, deleted media, changed privacy settings, or content created on the victim's behalf. The reports show CSRF chained with open redirects, cross-site flashing, permissive CORS and same-origin policy bypasses to raise severity.

It turns up almost everywhere state changes happen. The evidence lists logout endpoints, login and registration forms, profile and settings pages, account deletion, password reset and change, email change, OAuth authorisation and callback flows, account linking, shopping carts, comment and post creation, invitations, uploads, GraphQL endpoints, JSON APIs that also accept form encoding, WebSocket handshakes, admin actions, WordPress plugins, and custom-scheme deep links in mobile apps. If a request changes something and the only proof of intent is a cookie, it is worth a look.

The concept is simple. The victim is authenticated to the target site, so their browser holds a valid session cookie. The attacker gets the victim's browser to issue a request to a state-changing endpoint, either by loading a page the attacker controls or by embedding the request in content the victim views on the target itself. The browser attaches the cookie automatically, and if the server has no other check, the action succeeds as the victim.

Things to try

All 402

Each line worked in a disclosed report. Test only what a program's scope allows.

Other 95

  • Reset an API via a cross-site request.
  • Try a CSRF attack on a guest-catching feature and see whether it discloses an audio broadcast in a private group.
  • Send a crafted collaboration event that sets another user's form field, then wait for them to submit a request to a path the attacker chooses.
  • Import a tampered project export so that a merge request hides a malicious continuous integration pipeline file.

Token design and bypass 45

  • Craft a multipart boundary that the server's header parser rejects so the content type is treated as absent and the CSRF filter is skipped.
  • Send a request with an empty Authorization header alongside the session cookie and see whether the CSRF check is skipped.
  • Send a token revocation request cross-site while supplying a forged or altered XSRF token and see whether the revocation still happens.
  • Check for CSRF token design flaws such as tokens not tied to the user session.

Profile and account settings 32

  • Submit cross-site forms to profile, preference and settings endpoints and check whether fields change without a token.
  • Change account settings via a cross-site request and check whether the session token is verified.
  • Change business or company information through a cross-site request and confirm the change.
  • Change the primary account via a GET request without a CSRF token.

Email address and password reset 16

  • Change the password after following a reset link through a cross-site request and check whether the old password is required.
  • Remove the authenticity token from a password reset request and check whether the server still processes it.
  • Remove the CSRF middleware token from a password change request and see whether it is validated server-side.
  • Trigger a lost password request via a cross-site request.

GraphQL and API endpoints 16

  • Send a GraphQL mutation as a GET request or as a form-encoded POST and check whether CSRF protection is skipped.
  • Replay a JSON-only endpoint with a form-encoded body or a method override parameter and see whether it still processes the change.
  • Try to make API calls on behalf of another user by bypassing CSRF protection.
  • Test the POST heartbeats API for JSON CSRF.

Bypasses and variations

All 103
  • Test WordPress plugin endpoints such as comment posting and profile fields for CSRF.
  • Check whether the OAuth state parameter is missing or static across authorisation attempts.
  • Use permissive CORS rules to read responses or execute functions cross-origin.
  • Bypass a Referer check by crafting the request.
  • Use cross-site flashing to bypass CSRF.
  • Use a general technique to bypass CSRF protection.

Typical fixes

All 143
  • Require user confirmation for state-changing deep links.
  • Require a CSRF token and origin check on settings endpoints.
  • Require a CSRF token on the deletion endpoint.
  • Require a CSRF token on the logout endpoint.
  • Fix the open redirect and add CSRF protection to the flow.
  • Add CSRF protection to the plugin endpoints.

Tips for beginners

All 14
  • Start with the actions that hurt most: email change, password change after reset, account deletion, account linking and OAuth initiation. These are where a successful forgery becomes account takeover rather than a nuisance, and the evidence shows they are frequently unprotected.
  • Check the boring endpoints too. Logout, notification read status, cart add and remove, follows, privacy toggles and comment posting are common and easy to demonstrate. A forced logout or an unwanted follow is still a valid finding when the program accepts it.
  • Look at how the request is actually sent. If the endpoint is JSON-only, try whether it also accepts form-encoded input or a method override. If it is GraphQL, try a mutation as a GET or as a form-encoded POST. These are documented bypasses in the evidence, not speculation.
  • Test the token itself, not just its presence. Remove it, change it to an arbitrary value, reuse one from another session, and check whether it stays the same after login or is not tied to the session. A token that is accepted when wrong is no protection.
  • Check cookie attributes and SameSite behaviour. A token stored in a cookie without HttpOnly can be read by scripts, and a Lax cookie may be bypassable with a top-level navigation or method override. Report what you actually observe rather than assuming a bypass works.
  • For OAuth, check whether the state parameter is missing or static across attempts, and whether the initiation request carries a CSRF token. Then test whether a callback can be replayed to link your own third-party account to a victim.

Start here: a reading path

Open the path

Clear reports in order, easiest first.

Guides and techniques

View all

The best explainers, cheat sheets and technique posts on CSRF, from around the web.

Newest reports

All 978

Most recently disclosed.

New CSRF reports by email

Follow CSRF and get each week's new disclosures in one short email.

Free. New reports for what you follow, weekly by default. One-click unsubscribe. Privacy