Skip to content
XSS Write-up Intermediate

Account Takeover via XSS + CSRF and Browser Autofill Password

A stored cross-site scripting flaw in the Full Name field let an attacker inject HTML that caused the browser's autofill to populate a fake password field with the victim's saved credentials. The stolen password was then replayed in a cross-site request forgery to change the victim's account password without any interaction.

mohamedmehina31 Follow

Published on medium.com

Our goal is to change the victim’s email or password. However, as you can see, the request requires the current password, so even if we find a CSRF, we won’t be able to complete the request.

Mohamedmehina, on medium.com

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 application failed to encode user-controlled output in the Full Name field, allowing stored HTML and script injection, and the password change endpoint lacked CSRF protection beyond the session cookie.

Impact

An attacker could take over a victim's account by stealing their saved password and changing it, with no victim interaction, though the attack depends on the victim having saved credentials for autofill.

What the attacker needed

Victim has saved credentials for autofill; attacker can inject stored XSS in Full Name; victim views a page showing the injected name

How it was found

  1. Inject a stored XSS payload into the Full Name field.
  2. Use the XSS to fetch the victim's profile information from the same origin.
  3. Inject an email input and a password input to trigger browser autofill.
  4. Exfiltrate the autofilled email and password to an attacker-controlled server.
  5. Use the stolen password as current_password in a CSRF request to change the victim's password.

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.

The site let users put HTML code into their profile name, and that code ran in other people's browsers. The attacker used this to create a fake password box, which the browser automatically filled with the victim's saved password. The attacker then used that password to change the victim's account password.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More by mohamedmehina31

View all

1 more disclosed report, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.