From Stored XSS to Cookie Tossing into Credit Card Theft
A stored XSS in uploaded SVG files was served from a shared asset subdomain, allowing JavaScript to run on a sibling domain. Because authentication cookies were scoped to the parent domain, the attacker could plant cookies for the billing route and trick an admin into entering credit card details into the attacker's instance.
Published on medium.com
A couple of months ago, I discovered a pretty interesting client-side vulnerability chain on a large SaaS platform, a public program on HackerOne.
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 allowed SVG uploads with executable JavaScript and served them from a shared domain, while session cookies were scoped broadly to the parent domain, enabling cookie tossing.
Impact
An attacker could cause an administrator to enter credit card information into the attacker's instance, leading to credit card theft.
What the attacker needed
Attacker has an account on the platform; victim is an admin; victim opens a link to the malicious SVG; victim clicks the fake payment button
How it was found
- Upload an SVG file containing JavaScript to the comments feature.
- Open the uploaded SVG to confirm the stored XSS executes on the shared asset subdomain.
- Use JavaScript to create many junk cookies for the parent domain to create cookie jar pressure.
- Set attacker-controlled session cookies scoped only to the billing path.
- Embed a link in the SVG that points to the billing page of the attacker's instance.
- Send the victim a link to the SVG; when they click the fake payment button, they enter card details into the attacker's instance.
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 platform let users upload SVG image files, and those files were served from a shared domain used by all customers. An SVG file can contain JavaScript, so the attacker's file ran code in the browser of anyone who opened it. Since login cookies were shared across the whole company.com domain, that code could add extra cookies that only applied to the billing page, making the victim's browser talk to the attacker's account when they visited billing.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.