Skip to content
XSS Write-up Intermediate

XSS in The Digital #ClimateStrike Widget

The Digital Climate Strike widget's message listener accepted postMessage events from any origin and passed an unchecked linkUrl to a navigation function, allowing javascript: URLs. An attacker could open the victim site in a frame or popup and send a crafted message to execute arbitrary JavaScript in the site's context.

frederik-braun.com

Published on frederik-braun.com

Life keeps me busy, which is why this blog is seeing less and less publications. It's also the reason why I couldn't join the Global Climate Strike on September 20th.

The author, on frederik-braun.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 handler did not verify the origin of incoming postMessage events and did not validate the linkUrl before assigning it to document.location, permitting javascript: URL execution.

Impact

An attacker could execute arbitrary JavaScript in the context of any website embedding the widget, potentially leading to actions such as data theft or page defacement, though the report does not detail specific consequences.

What the attacker needed

Victim site embeds the widget; attacker can open victim site in frame or popup; attacker has a JavaScript handle to the window

The fix

The patch added an origin check to ensure messages come only from the legitimate iframe host and restricted navigateToLink to URLs starting with 'http'.

How it was found

  1. Open the victim website in an iframe or popup while keeping a JavaScript handle to the window.
  2. Send a postMessage containing the DIGITAL_CLIMATE_STRIKE flag, the buttonClicked action, and a javascript: URL as linkUrl.
  3. The widget's receiveMessage handler calls navigateToLink with the supplied URL, executing the JavaScript.

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.

Websites can talk to each other through a browser feature called postMessage. This widget listened for such messages but never checked who sent them, and it also trusted a web address supplied in the message. An attacker could therefore send a message containing a special javascript: address, which the browser would run as code on the victim'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.

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.