Reflected XSS to Account Takeover
A reflected XSS vulnerability in a login confirmation page allowed an attacker to run script in a victim's browser. The attacker used this to change the victim's email address without knowing their password, then reset the password and take over the account.
During a recent penetration test, I discovered a significant security flaw in an application that allowed for the manipulation of user email addresses through a reflected Cross-Site Scripting (XSS) vulnerability. This vulnerability made it possible for attackers to change a user’s email address to one they control…
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
Root cause
Likely the email change form lacked a check that the request came from the user (such as requiring the current password), and a reflected XSS on the login confirmation page let an attacker run script in the victim's session to bypass the nonce protection.
Impact
An attacker could take over a victim's account by changing their email and resetting the password, provided the victim runs the attacker's script while logged in.
What the attacker needed
Victim is logged in; victim runs attacker's script; attacker can deliver a link or script
How it was found
- Find a reflected XSS on the login confirmation page via the email parameter.
- Create a script that fetches the account edit page and extracts the nonce.
- Use the nonce to send a POST request that changes the victim's email to the attacker's address.
- Deliver the script to the victim through the reflected XSS.
- Use the password reset function with the new email to get a reset link.
- Reset the password and log in to the victim's account.
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.
Cross-Site Scripting (XSS) is when a website shows user input without cleaning it, so an attacker can make the site run their own JavaScript in a victim's browser. Here, the attacker tricked a logged-in user into running a script that changed the user's email address to one the attacker controlled. Then the attacker used the normal 'forgot password' feature to reset the password and log in as the victim.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.