From Swagger to XSS: Turning a Misconfigured configUrl into a $40
A production Swagger UI instance accepted a configUrl parameter that loaded external JSON without validation, allowing an attacker to inject a malicious configuration. This led to reflected cross-site scripting, enabling arbitrary JavaScript execution in the context of the trusted corporate domain.
A practical story of how automated recon, historical URL mining, and careful testing led to a Medium-severity Reflected XSS — responsibly disclosed and rewarded with $400 via HackerOne to a major telecommunications company.
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 instance failed to validate or restrict the origin of the configUrl parameter, allowing attacker-controlled external JSON to be loaded and rendered.
Impact
An attacker could execute arbitrary JavaScript in the context of the trusted corporate domain, potentially leading to UI manipulation, phishing injection, and abuse of the domain's reputation.
What the attacker needed
Victim clicks a crafted link; attacker hosts a malicious JSON file
How it was found
- Enumerate subdomains and filter live hosts.
- Mine historical URLs and grep for swagger-ui.html.
- Identify the configUrl parameter on the Swagger UI endpoint.
- Host a malicious JSON file externally.
- Access the endpoint with configUrl pointing to the malicious file.
- Observe JavaScript execution confirming reflected XSS.
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 tool that displays API documentation. The configUrl setting tells it where to fetch the documentation from. Because the site did not check where that file came from, an attacker could point it to their own file containing harmful code, which then ran in the victim's browser.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.