Lab: CSRF where token validation depends on token being present
This lab's email change functionality is vulnerable to CSRF.
To solve the lab, use your exploit server to host an HTML page that uses a CSRF attack to change the viewer's email address.
You have an account on the application that you can use to help design your attack. The credentials are:
With your browser proxying traffic through Burp Suite, log in to your account, submit the "Change email" form, and find the resulting request in your Proxy history.
Send the request to Burp Repeater and observe that if you change the value of the
csrf parameter then the request is rejected.
csrf parameter entirely and observe that the request is now accepted.
If you're using Burp Suite Professional, right-click on the request, and from the context menu select Engagement tools / Generate CSRF PoC. Enable the option to include an auto-submit script and click "Regenerate".
If you're using Burp Suite Community Edition, use the following HTML template and fill in the request's method, URL, and body parameters. You can get the request URL by right-clicking and selecting "Copy URL".
<form method="$method" action="$url">
<input type="hidden" name="$param1name" value="$param1value">
Go to the exploit server, paste your exploit HTML into the "Body text" box, and click "Store".
To verify if the exploit will work, try it on yourself by clicking "View exploit" and checking the resulting HTTP request and response.