- Capture and Analyze Requests
- Use Burp Suite or a similar tool to intercept and analyze requests to identify the presence and nature of any CSRF tokens.
- Document the structure of requests and identify where the CSRF token is located (e.g., in
headers
,cookies
, or request bodies).
- Token Predictability and Strength
- Evaluate if the CSRF tokens are predictable or easily guessable by analyzing their patterns.
- Check the entropy and randomness of the CSRF tokens. Low entropy might indicate weak tokens.
- Header-Based Token Manipulation
- If the CSRF token is included in a header, temporarily remove it from the request to see if the request is still processed.
- Modify the token value within the header to see if the application properly validates it.
- Body-Based Token Manipulation
- For tokens included in the request body, remove the value of the CSRF token parameter and see if the request succeeds.
- Remove both the CSRF token parameter and its value to test if the request is still valid without it.
- Cross-User Token Reuse
- Test if the same CSRF token is reused across different user accounts, which would indicate poor token management.
- Token Substitution
- Replace the CSRF token with a different value of the same length to check if the application validates the token correctly.
- Method Manipulation
- Modify the request method from
POST
toGET
and remove the CSRF token to see if the application still processes the request. - For
PUT
orPATCH
requests, append the_method
parameter to the request body to emulate a different request method and test CSRF protection.
- Modify the request method from
- Content-Type Handling
- Test if the application accepts different content types (e.g.,
application/x-www-form-urlencoded
,text/plain
). Modify the request body accordingly and observe the response. - Test with multipart/form-data content type to see if the application processes requests correctly.
- Test if the application accepts different content types (e.g.,
- Referer Validation Bypass
- Include the following code in your CSRF PoC HTML file to bypass Referer validation:
<meta name="referrer" content="never">
- Test using a custom Referer header value to check if the application relies solely on Referer headers for CSRF protection.
- Include the following code in your CSRF PoC HTML file to bypass Referer validation: