Skip to content
XSS Write-up Intermediate

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.

dr34m14 Follow

Published on dr34m14.medium.com

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.

dr34m14, on dr34m14.medium.com

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

  1. Enumerate subdomains and filter live hosts.
  2. Mine historical URLs and grep for swagger-ui.html.
  3. Identify the configUrl parameter on the Swagger UI endpoint.
  4. Host a malicious JSON file externally.
  5. Access the endpoint with configUrl pointing to the malicious file.
  6. 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.

More by dr34m14

View all

5 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.