Skip to content
XSS Write-up Intermediate

$8,400 for a Message With No Return Address Check: postMessage Origin Validation Bypass to Account…

The postMessage handler on a collaborative document platform checked the sender's origin using a substring match rather than an exact match, so any domain containing the trusted domain name as a substring passed the check. An attacker could host a page on such a domain, open the victim's account page in a popup, and send a forged verification message to mark any known or guessable user ID as identity-verified without real verification.

T4nv1 Follow

Published on medium.com

Browsers give web pages a way to talk to each other across different origins when they genuinely need to — an embedded payment widget communicating with its parent page, a popup OAuth flow passing a result back to the window that opened it. The postMessage API is how that conversation happens, deliberately allowed to…

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

The message event handler validated the sender's origin using a substring search (indexOf) instead of an exact match against the full expected origin, so any domain containing the trusted substring passed the check.

Impact

An attacker could forge the verification completion message for any known or guessable user ID, bypassing identity verification entirely without interacting with the real verification service.

What the attacker needed

Attacker-controlled domain containing trusted substring; victim opens attacker page; known or guessable victim user ID

The fix

The origin check was fixed to use exact matching and server-side token validation was added as defence in depth.

How it was found

  1. Register a domain whose name contains the trusted substring.
  2. Build a page that opens the target account page in a popup window.
  3. After a delay, send a forged verification message to the popup.
  4. Confirm the forged message triggers account verification on a self-controlled test account.

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.

Web pages from different sites can send messages to each other using a browser feature called postMessage. The receiving page is supposed to check exactly who sent the message before trusting it. Here the check only looked for the trusted name somewhere inside the sender's address, so an attacker could register a domain that contains that name and send fake messages that were accepted.

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 T4nv1

View all

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