Bug Writeup: Stored XSS to Account Takeover (ATO) via GraphQL API
A merchant could supply a confirmation URL containing a JavaScript payload that was stored and later rendered inside a script tag on the main website. An attacker could use this stored XSS to change the victim's email address and take over their account.
Jun 29, 2023 · 16 min read · writeupxssgraphqlhackerone ·
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 inserted user-controlled input (the returnUrl parameter) directly into a JavaScript string inside a script tag without proper escaping or validation.
Impact
An attacker could take over a victim's account by changing their email address via the stored XSS.
What the attacker needed
Attacker can supply a confirmation URL; victim visits a specific page on the main site
How it was found
- Submit a GraphQL mutation to the payments API with a returnUrl containing a JavaScript payload.
- Visit the unique static URL on the main website that renders the stored returnUrl.
- The payload executes in the context of the main site, allowing actions such as changing the account email.
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 payment system let a merchant set a web address that would be shown to customers later. The site put that address inside a script without cleaning it, so a malicious merchant could run their own code in the customer's browser. That code could then change the customer's email address, letting the attacker reset the password and take over the account.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.