CSRF

Summary

Cross-site request forgery (also known as CSRF) is a web security vulnerability that allows an attacker to induce users to perform actions that they do not intend to perform.

3 conditions:

  • A relevant action.

  • Cookie-based session handling.

  • No unpredictable request parameters.

How to find:

  • Remove CSRF token from requests and/or put a blank space.

  • Change POST to GET.

  • Replace the CSRF token with a random value (for example 1).

  • Replace the CSRF token with a random token of the same restraints.

  • Extract token with HTML injection.

  • Use a CSRF token that has been used before.

  • Bypass regex.

  • Remove referer header.

  • Request a CSRF by executing the call manually and use that token for the request.

Approach

Quick attacks

Tools

Example 1

Example 2

Json CSRF

CSRF Token Bypass

CSRF sample POC

CSRF to reflected XSS

Mindmaps

Last updated

Was this helpful?