Skip to content
XSS Write-up Advanced

XSS in Google IDX Workstation

The webWorkerExtensionHostIframe.html endpoint in Code OSS (used by GitLab Web IDE and Google IDX) accepted a parentOrigin parameter that could be set to an attacker-controlled origin, allowing cross-origin postMessage messages to reach the extension host worker. An attacker could then send crafted messages that caused the worker to load and execute arbitrary JavaScript from their domain, leading to XSS in the worker context and potential theft of CSRF tokens and creation of personal access tokens.

sudi Follow

Published on sudistark.github.io

Bounty$22,500 View original

In this blogpost I am going talk about one my bugs which I submitted to Google VRP last year. The report is disclosed publically but I really felt it’s hard to understand the inner working of the bug just based on the report I wanted to do a very detailed blogpost so here I am :)

sudi, on sudistark.github.io

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 parentOrigin parameter was taken from the URL query string without validation, so the origin check for incoming postMessage events could be bypassed by supplying an attacker-controlled origin.

Impact

An attacker could execute JavaScript in the context of the worker, steal CSRF tokens, and create personal access tokens with broad scopes, potentially leading to account takeover; however, in Google IDX the frame-ancestors CSP limited which domains could embed the iframe, and the vulnerable code path was not automatically triggered.

What the attacker needed

Victim visits attacker page; attacker can host content on allowed origin; victim logged into target

How it was found

  1. Set up a vulnerable GitLab instance locally using Docker.
  2. Open a repository in the Web IDE and locate the webWorkerExtensionHostIframe.html endpoint.
  3. Modify the iframe src to include a parentOrigin parameter pointing to an attacker-controlled domain.
  4. Host a malicious page that sends crafted postMessage data to the iframe, including a message that instructs the worker to load a JavaScript file from the attacker's domain.
  5. Observe the XSS executing in the worker context and the script fetching a CSRF token and creating a personal access token.

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 bug is about a web page that is supposed to only accept messages from its own website, but it trusted a value that an attacker could set. By tricking the page into thinking the attacker's site was allowed, the attacker could send instructions that made the page run malicious code. That code ran in a background worker (a separate script that runs without a visible page) and could still make requests as the logged-in user.

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 sudi

View all

14 more disclosed reports, best first.

More from Google

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.