XSS in Google IDX Workstation → RCE! $22,500 Bounty Earned
A postMessage origin validation flaw in Google IDX Workstation allowed an attacker to inject JavaScript into a victim's workstation, potentially leading to remote code execution and theft of gcloud tokens with full cloud-platform scope.
medium.com
Published on medium.com
Cloud dev environments are powerful — but they can be dangerous in the wrong hands. Recently, a critical XSS vulnerability in Google’s IDX Workstation was discovered, leading to Remote Code Execution (RCE) and potential compromise of Google Cloud projects.
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 iframe that relays postMessages trusted a parentOrigin value taken from the URL query string instead of validating the real sender origin.
Impact
An attacker could execute arbitrary JavaScript in the victim's IDX workstation, potentially achieve remote code execution, and leak gcloud tokens with full cloud-platform scope; the attacker must first know the victim's workstation subdomain, which could be leaked via referer headers or unencrypted DNS.
What the attacker needed
Attacker knows victim's IDX subdomain; victim clicks a link; attacker has a workstation
The fix
The iframe hosting webWorkerExtensionHostIframe.html should be moved to a separate origin from the main Code OSS UI, and postMessage origins should be strictly validated.
How it was found
- Create a workstation and copy the Share Preview Link, then remove the 9000- prefix to learn the victim's IDX domain.
- Create an attacker workstation and similarly obtain its domain.
- Prepare a chain of scripts and an IPython notebook that point to each other.
- Upload the notebook to the attacker's workstation and note its file path.
- Host an exploit HTML page with the right variables and send its link to the victim.
- The victim clicks the link, allowing the attacker to read local files and potentially escalate to RCE.
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 web page can send messages to another page it embeds, and the receiving page should check who sent the message. Here the check could be bypassed, so an attacker's page could send messages that made the victim's cloud coding environment run the attacker's JavaScript. That could let the attacker read files and steal access tokens for Google Cloud.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.