Skip to content
XSS Write-up Intermediate

How I found DOM XSS via postMessage on Bing.com - Microsoft Bug Bounty

A Bing page listened for postMessage events and wrote the supplied points balance into the page as HTML, so a crafted message could inject markup. An attacker who got a victim to load a page that opened Bing and posted messages could run script in Bing's origin and read cookies.

Nam Le Follow

Published on namcoder.com

The website Bing.com has message event listeners. I found a feature that listens for postMessage with two arguments to update the User header bar with the user’s points badge.

Nam Le (@namcoder_com), on namcoder.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

What the attacker needed

Victim visits attacker page; popup to Bing allowed

How it was found

  1. Open the browser developer tools and view the global event listeners.
  2. Look through the message listeners for the page.
  3. Find code that writes data into the DOM, such as innerHTML or location changes.
  4. Identify the widget script whose message handler writes the points value with innerHTML.
  5. Open a Bing page from an attacker page and repeatedly post a message with a crafted points value.

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 can receive messages from other windows using a browser feature called postMessage. This page took the message contents and inserted them into the page as HTML instead of plain text, so a malicious page could send HTML containing a script that runs on Bing.

What is XSS?

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

More from Microsoft (Bing)

View all

The newest disclosed reports for this program.

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.