Cross-Site Request Forgery

Cross-Site Request Forgery (CSRF/XSRF) is an attack that forces an end user to execute unwanted actions on a web application in which they're currently authenticated. CSRF attacks specifically target state-changing requests, not theft of data, since the attacker has no way to see the response to the forged request. - OWASP

Summary

  • Methodology

  • Payloads

    • HTML GET - Requiring User Interaction

    • HTML GET - No User Interaction)

    • HTML POST - Requiring User Interaction

    • HTML POST - AutoSubmit - No User Interaction

    • JSON GET - Simple Request

    • JSON POST - Simple Request

    • JSON POST - Complex Request

  • Bypass referer header validation check

    • Basic payload

    • With question mark payload

    • With semicolon payload

    • With subdomain payload

  • References

Tools

Methodology

CSRF_cheatsheet

Payloads

When you are logged in to a certain site, you typically have a session. The identifier of that session is stored in a cookie in your browser, and is sent with every request to that site. Even if some other site triggers a request, the cookie is sent along with the request and the request is handled as if the logged in user performed it.

HTML GET - Requiring User Interaction

HTML GET - No User Interaction

HTML POST - Requiring User Interaction

HTML POST - AutoSubmit - No User Interaction

JSON GET - Simple Request

JSON POST - Simple Request

JSON POST - Complex Request

Bypass referer header validation

Basic payload

With question mark(?) payload

With semicolon(;) payload

With subdomain payload

References

Last updated