Table of Contents

CSRF Testing

Find areas that should have CSRF protection and test if it's actually enforced.

8-Step Test

  1. Standard CSRF test – remove the token entirely
  2. Change method to GET
  3. Change CSRF token value to undefined
  4. Delete CSRF token value or entire parameter
  5. Use same CSRF token across two different accounts
  6. Replace CSRF token with same-length random string
  7. Change content-type from application/json to text/plain
  8. Use a vulnerable subdomain to bypass CSRF token validation

Bypass Techniques

Blank Referer

<meta name="referrer" content="no-referrer" />

iframe data URI

<iframe src="data:text/html;base64,BASE64_ENCODED_FORM">

Referer Bypass

If they check that their domain is in the Referer header:

https://yoursite.com/https://theirsite.com/

The parser may match theirsite.com as a substring.

Clickjacking CSRF

Wrap the sensitive form in an iframe for clickjacking – forces user interaction that carries their session. See Bug Chaining for details.

Focus Areas

Escalation

See Also