Skip to content
XSS Write-up Beginner

How I Found an XSS Vulnerability in Swagger UI Using a Nuclei Tem

An XSS vulnerability was found in Swagger UI where a payload was reflected in the response. An attacker could steal session cookies or credentials from users of the API documentation interface.

Anonymousshetty Follow

Published on medium.com

Swagger, a popular tool for designing and documenting APIs, is widely used by developers to streamline their API development process. However, like any software, it is not immune to vulnerabilities.

Anonymousshetty, on 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

Impact

Attackers could steal session cookies to hijack accounts or capture credentials entered in forms, though the text does not specify any defences that limited the exploit.

What the attacker needed

Target runs vulnerable Swagger UI; attacker can send crafted requests

The fix

The vulnerability was fixed by updating Swagger UI to the latest version with security fixes.

How it was found

  1. Create a Nuclei template targeting Swagger UI endpoints with a reflected XSS payload.
  2. Run the Nuclei scanner against the target Swagger UI endpoint.
  3. Observe that the payload is reflected in the response, confirming the XSS.
  4. Manually inject the payload into the Swagger UI interface and see the JavaScript alert.

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) is when a website shows user-supplied text without cleaning it, so an attacker can make the site run their JavaScript. Here, the Swagger UI page reflected a test payload, meaning the input came back in the page and executed. This could let an attacker steal cookies or login details from people using that page.

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 Anonymousshetty

View all

9 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.