Unmasking Basic Csrf Bug Hunter
The application's email change endpoint lacked any CSRF protection, so an attacker could craft a page that silently submits a request to change a logged-in victim's email address. The author demonstrates this on a PortSwigger lab, where the change succeeds without a token.
Hey, guys welcome to my blog so today we are going to discuss about CSRF vulnerability which is probably medium/low severity and we are going to solve the basic portswigger lab of CSRF finale we end up with some common defenses against CSRF
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Impact
An attacker could change a logged-in victim's email address without their consent, which could lead to account takeover if the email is used for password reset.
What the attacker needed
Victim is logged in; victim visits attacker's page
The fix
The endpoint should be fixed by requiring a unique, unpredictable CSRF token and setting SameSite cookies.
How it was found
- Log in to the application.
- Find a state-changing endpoint such as email change.
- Capture the email change request and check for a CSRF token in the body, cookie, or headers.
- Generate an HTML form that submits the same request.
- Open the form in a browser and submit it.
- Observe that the email address changes, confirming the vulnerability.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
CSRF (Cross-Site Request Forgery) is when a malicious website makes a logged-in user's browser send a request to another site without the user knowing. Here, the email change form had no secret token to prove the request came from the real site, so any other site could submit it. The attacker could change the victim's email address, which might then be used to take over the account.
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.