Swagger-UI XSS Leading to Account Takeover on Crypto Exchange
A Swagger-UI page accepted a user-supplied configUrl parameter pointing to an attacker-hosted JSON file, which in turn referenced a YAML file containing JavaScript. When a victim opened the crafted link, that script ran in the target's origin, letting an attacker read the victim's cookies and potentially take over the account.
Hello, scr1pty on touch! I’m a security guy who decided to change his life once and move my career from security management to ethical hacking.
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 Swagger-UI page trusted a user-controlled configUrl parameter and loaded a remote configuration and specification file without restricting where it could come from, so attacker-supplied JavaScript was executed in the site's origin.
Impact
An attacker could capture a victim's session cookies and gain unauthorised access to their account, including admin privileges if the victim is an administrator; the report only demonstrates a pop-up as proof.
What the attacker needed
Victim clicks a crafted link; attacker-hosted config files; Swagger-UI exposed on target
How it was found
- Find the Swagger-UI path on the target during reconnaissance.
- Host a JSON configuration file that points to a second YAML file containing the script.
- Build a link to the Swagger-UI page with the configUrl parameter set to the hosted JSON file.
- Send the link to a victim so the page loads the files and runs the script.
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.
Swagger-UI is a page that documents and tests an API. This page let a visitor supply a link to a configuration file, and the page loaded and ran whatever that file pointed to. Because the code ran as if it came from the real site, it could read the visitor's login cookies, which is how an attacker could hijack 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.