An XSS Journey: From Self-XSS to Account Takeover
A stored cross-site scripting (XSS) vulnerability in a workflow form allowed an attacker to execute JavaScript in another user's browser. By chaining API calls, the attacker could create a new admin user in the victim's tenant, leading to account takeover.
medium.com
Published on medium.com
I was invited to a private bug bounty program of a typical cloud application where you can create workflows and handle invoices for yourself as well as customers or external companies.
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 properly sanitise user input in workflow form fields, allowing JavaScript execution, and the API endpoints for user creation lacked sufficient authorization checks.
Impact
An attacker could execute arbitrary JavaScript in a victim's browser and create a new admin user in the victim's tenant, leading to account takeover.
What the attacker needed
Attacker has an account; victim has an account in another tenant; victim opens the malicious workflow form; attacker can upload a text file
How it was found
- Create a workflow form with a field vulnerable to XSS and save it.
- Add another user (victim) to the workflow and confirm the XSS payload executes when they open it.
- Use Burp Suite to identify the API requests needed to create a new admin user.
- Chain the API calls (get-auth-token, get-subscriber-id, get-session-token, create-user) in JavaScript.
- Bypass the 255-byte field limit by uploading a text file containing the JavaScript and loading it via a Blob.
- Invite an admin user from another tenant to the workflow; when they open it, the script runs and creates a new admin user in their tenant.
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 code in someone else's browser. Here, the attacker saved a malicious script in a form, and when another user opened it, the script ran and made requests to create a new admin account without the victim's knowledge.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.