Skip to content
XSS Write-up Intermediate

XSS to Account takeover in payu.in

A POST-based cross-site scripting flaw existed in the email parameter of a payment page, and because the authentication token was stored in a cookie shared across subdomains and the API accepted cross-origin requests from any subdomain, an attacker could steal the token and the user's UUID to change the account name. The author claims this leads to full account takeover when a victim visits a malicious page.

theamanrawat.github.io

Published on theamanrawat.github.io

Hi, I found a POST based XSS and then I escalated it to acheive complete account takeover when victim visits my website. So here is the writeup in which I will show you that How I escalated it.

The author, on theamanrawat.github.io

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 field was not sanitised before being reflected into the page, the authentication cookie was shared across subdomains, and the API's CORS policy allowed any subdomain to make authenticated cross-origin requests.

Impact

An attacker could take over a victim's account by changing account details when the victim visits a malicious page, provided the victim is logged in and the browser allows the cross-origin requests.

What the attacker needed

Victim is logged in to payu.in; victim visits attacker's page; attacker has a payu.in account

How it was found

  1. Create an HTML page with a hidden form that auto-submits a POST request to the payment page, placing a script payload in the email field.
  2. Open the HTML page in a browser to trigger the reflected XSS and confirm script execution.
  3. Use the script to read the authentication token from the cookie named merchantAccessToken.
  4. Use the token to send a GET request to the merchants API endpoint and extract the user's UUID from the response.
  5. Use the token and UUID to send a PUT request that changes the account name to 'HACKED'.

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) lets an attacker run their own JavaScript in a victim's browser on a trusted site. Here the script could read a login token stored in a cookie and use it to call the site's API, because the API trusted requests coming from any of the company's subdomains. With that token and the user's ID, the attacker could change account details.

What is XSS?

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

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.