PortSwigger

Description *Use the exploit server to host an HTML page that uses a CSRF attack to change the viewer’s email address. The server validates the CSRF token only if it is present — if the token is omitted entirely, the request is accepted.
Your credentials: wiener:peter*
Solution Steps
Step 1: Log In and Capture the Request
- Log in to your account using
wiener:peter - Go to “Update email” form
- Submit a test email change
- Capture the request in Burp Proxy (HTTP history)
The POST request looks like:


Step 2: Test Token Validation
Send the request to Burp Repeater and:
- Change the
csrfparameter value - Observe that the request is rejected (invalid token)

Step 3: Delete the CSRF Token
Delete the csrf parameter entirely from the request:

- Observe: The request is now accepted even with no token!
Step 4: Generate CSRF PoC
Since the CSRF token is not needed, the exploit is simple.
Use the following HTML template (no csrf parameter):
<form method="POST" action="https://YOUR-LAB-ID.web-security-academy.net/my-account/change-email">
<input type="hidden" name="email" value="anything@web-security-academy.net">
</form>
<script>
document.forms[0].submit();
</script>
Replace:
YOUR-LAB-IDwith your actual lab IDhihi@hihi.comwith any unused email address
Note: There is no csrf input field because the token is omitted entirely!
Step 6: Upload to Exploit Server
- Go to the exploit server
- Paste your exploit HTML into the “Body” section
- Click “Store”

Step 7: Test the Exploit
- Click “View exploit” to test it on yourself
- Check that your email address changes
- Important: Change the email address in your exploit so it doesn’t match your own

Step 8: Deliver to Victim
- Click “Deliver to victim”
- The victim’s email address is changed
- The lab is marked as Solved

Key Points
| Requirement | Value |
|---|---|
| HTTP Method | POST |
| Endpoint | /my-account/change-email |
| Parameters | email= ONLY (no csrf) |
| Auto-submit | document.forms[0].submit() |
Important Notes
- Do NOT include a
csrfparameter in your exploit - Test on yourself first to verify it works
- Use a different email for the final exploit