Skip to content
XSS Write-up Intermediate

How I Turned a Tiny Security Flaw into a $250 Bounty

The application used postMessage without validating the sender's origin and passed message data to eval(), allowing an attacker to execute arbitrary JavaScript in the context of the vulnerable site. The author demonstrated this with a proof-of-concept that triggered an alert, showing that stored XSS was possible.

ramshath1999 Follow

Published on medium.com

Imagine this: you're casually testing a website, poking around, looking for vulnerabilities, and BAM! You uncover something that turns out to be not just a critical security issue but also a ticket to a $250 reward.

Ramshath, 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 failed to validate the origin of postMessage events and passed the message data directly to eval() without sanitisation.

Impact

An attacker could steal cookies and session tokens, hijack sessions, and inject phishing forms; because the XSS was stored, the payload would execute every time someone interacted with the vulnerable feature.

What the attacker needed

Victim visits attacker's page; victim interacts with vulnerable feature

The fix

The application should validate the origin of postMessage events, avoid using eval(), implement a strong Content Security Policy, and sanitise all inputs.

How it was found

  1. Create an HTML page that opens the target application in a new window and sends a malicious postMessage after a delay.
  2. Host the page on an attacker-controlled server.
  3. Open the malicious page and click the launch link to send the payload.
  4. Observe that the payload executes on the target site (an alert appears).

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.

This report describes a stored cross-site scripting (XSS) flaw. The website accepted messages from any other website and then ran the message content as code, so an attacker could make the site run their own script. That script could steal cookies or session tokens, letting the attacker impersonate users.

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 ramshath1999

View all

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