Skip to content
XSS Write-up Intermediate

How I got a Stored XSS by searching through JS files.

A stored cross-site scripting flaw existed in a customer name field that was rendered unsanitised on a hidden homepage endpoint. An attacker could inject a link with a JavaScript URL that, when clicked, read sensitive personal data from the browser's local storage and sent it to an external server.

medium.com

Published on medium.com

Hello Friend, I’m gonna talk about a simple Stored XSS vulnerability I did find in a private bug bounty program at Bugcrowd by searching in the JS files for any hidden directories.

oXnoOneXo, 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

Root cause

Likely the application rendered the customer name field without proper output encoding or sanitisation on the hidden homepage endpoint.

Impact

An attacker could steal personal information (email, name, user ID, permissions) from local storage, but the HTTPOnly cookie flag limited cookie theft and the payload required a user to click a link.

What the attacker needed

Ability to set a customer name; victim clicks a crafted link

How it was found

  1. Search JavaScript files for hidden API endpoints using developer tools.
  2. Visit the discovered endpoint /platform/apps/lighthouse-homepage.
  3. Notice that an HTML payload previously entered in a customer name field is rendered on that page.
  4. Update the customer name again and confirm the payload changes on the page.
  5. Try multiple XSS payloads; an anchor tag with a javascript: URL works.
  6. Craft a payload that reads local storage, extracts sensitive data with a regex, and sends it to an external collaborator.

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 displays user input without cleaning it, so an attacker can sneak in code that runs in a victim's browser. Here, a name saved in a customer profile was shown on another page without being made safe, so a malicious link could run and steal information stored in the browser.

What is XSS?

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

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.