Detection
Identify state-changing endpoints
Detection
CSRF testing only matters against requests that can actually change server-side state, as established in what is csrf. The first step is therefore not to test every endpoint uniformly, but to build a complete inventory of the application's state-changing operations.
Walk through the application using an intercepting proxy such as Burp Suite or OWASP ZAP and perform every action available to the account.
Look for operations such as:
Profile updates.
Password changes.
Email changes.
MFA enrollment or removal.
Account recovery actions.
Purchases and payment changes.
Transfers or other financial operations.
Resource creation, modification, or deletion.
Settings and preference changes.
Role or permission changes.
Subscription changes or cancellations.
Logout.
Any other action that changes account or application state.
Flag requests using methods normally associated with state changes:
POST
PUT
PATCH
DELETEAlso explicitly look for GET requests with side effects.
GET /account/delete?confirm=true
GET /settings/enable-feature
GET /logoutAs discussed in where CSRF vulnerabilities occur, a state-changing GET is particularly important because the request may be triggerable through nothing more than a navigation or resource load.
State-changing GET
↓
Potentially triggerable through:
<a href="...">
<img src="...">
iframe
Redirect
↓
High-priority CSRF test candidateFor each identified endpoint, record the relevant details:
Endpoint: POST /api/account/email
Action: Changes registered email address
Authentication required?
Yes
State-changing?
Yes
CSRF token present?
Yes / NoOther apparent protections?
SameSite
Origin validation
Custom header requirement
Re-authentication
Confirmation flowThe goal is to produce a map like this:
Application action
↓
Underlying request
↓
HTTP method
↓
Authentication requirement
↓
CSRF or request-integrity mechanism
↓
Test priorityAn endpoint with no obvious CSRF token is often worth testing early, but the absence of a visible token is not itself proof of a vulnerability. The application may rely on another mechanism, such as:
SameSitecookie restrictions.OriginorReferervalidation.A required custom request header that a cross-origin form cannot set.
Re-authentication.
Another server-side request-integrity control.