Skip to content
XSS Write-up Intermediate

postMessage DOM XSS vulnerability in Gartner Peer Insights widget

The Gartner Peer Insights widget checked only that the string 'gartner.com' appeared anywhere in the sender's origin, so a site like gartner.com.attacker.com could send a crafted postMessage that was rendered via innerHTML, leading to DOM XSS on any vendor site embedding the widget. An attacker could execute arbitrary JavaScript in the victim site's context, affecting confidentiality and integrity of user data and enabling phishing content.

Justin Steven Follow

Published on kindergartner.computerhacker.ring0.lol

This website is not affiliated with Gartner. If you are looking for the Gartner website, go to www.gartner.com.

Justin Steven (@justinsteven), on kindergartner.computerhacker.ring0.lol

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 widget's origin check used a substring match on the sender's origin instead of an exact or suffix match, and then inserted message data into the DOM via innerHTML without sanitisation.

Impact

A malicious site could execute arbitrary JavaScript in the context of any vendor site embedding the widget, violating confidentiality and integrity of user data and enabling phishing content; Gartner's later patches limited exploitation to *.gartner.com and then added sanitisation.

What the attacker needed

Victim visits attacker-controlled site; attacker domain contains 'gartner.com'; victim site embeds the widget

The fix

The widget should check that the sender's hostname is exactly 'gartner.com' or ends with '.gartner.com', and should avoid inserting message data via innerHTML; Gartner later added origin restrictions and sanitisation.

How it was found

  1. The attacker hosts a page on a domain whose origin contains 'gartner.com'.
  2. The attacker's page opens the victim vendor site in a popup window.
  3. The attacker's page sends a crafted postMessage to the opened window.
  4. The widget's handler accepts the message because the origin contains 'gartner.com'.
  5. The widget builds HTML from the message data and sets it via innerHTML, executing the payload.

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.

A widget that vendors embed on their sites listens for messages from other windows. It tried to check the sender was from Gartner by looking for 'gartner.com' anywhere in the sender's web address, so an attacker could register a lookalike domain containing that text. The widget then inserted data from the message directly into the page as HTML, letting the attacker run their own JavaScript on the vendor's site.

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 Justin Steven

View all

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