CSRF Testing Methodology: From Detection to Exploitation
1 min read
Summary
Cross-Site Request Forgery (CSRF) allows an attacker to infiltrate an application to perform an undesired function.
To identify CSRF vulnerabilities, look for features that allow changes to a user’s data or account and explore the HTTP requests that handle these features, looking for weaknesses.
Any requests that don’t use POST, PUT, DELETE or another state-changing method, are not CSRF vulnerabilities.
Analyse the requests to identify the mechanism of authentication and any CSRF protection tokens and verify if the protections are adequate.
If requests are unprotected, the attacker can use a simple HTML form to craft a malicious proof of concept (POC).
host this on an external domain or exploit server to confirm if an action can be performed without user interaction.
Further testing might require more complex POCs using JavaScript-based fetch, exploiting JSON endpoints, or using image or iframe-based CSRF to exploit vulnerabilities.