Google VRP · XSS → RCE · Accepted & Fixed
A cloud IDE, a trusted iframe, and full RCE
One attacker-controlled origin parameter turned a victim's cloud workstation into the attacker's shell.
*.cloudworkstations.dev), the webWorkerExtensionHostIframe.html page took its trusted parentOrigin from a URL parameter. By controlling that value, an attacker could relay arbitrary postMessage traffic into a victim's workstation, execute arbitrary JavaScript in the workspace, escalate to remote code execution, and reach gcloud tokens with full cloud-platform scope. Reported to Google VRP — accepted, fixed, and rewarded $22,500.Background
Cloud development environments are powerful — a full IDE, terminal and cloud credentials living in a browser tab. That power cuts both ways: if script execution inside the workstation's origin can be hijacked, the attacker inherits everything the workstation can do. This vulnerability in Google's IDX Workstation did exactly that, and it echoes a past GitLab XSS → RCE issue built on the same pattern.
One precondition mattered: the attacker had to know the victim's IDX workstation subdomain. The article notes two realistic leak channels — Referer headers sent to third-party domains (for example open-vsx.org), and unencrypted DNS queries observable on the same network.
The vulnerability
The root cause was postMessage origin validation in webWorkerExtensionHostIframe.html. The page derived the origin it trusted from the URL itself:
const parentOrigin = searchParams.get('parentOrigin') || window.origin;
self.onmessage = (event) => {
if (event.origin !== parentOrigin) return;
worker.postMessage(event.data, event.ports);
}
Because parentOrigin came from a search parameter, an attacker could set it to an origin they controlled. The check then passed for attacker messages, and the iframe relayed arbitrary postMessages — including binary data converted to hex — straight into the worker. That relay is the XSS primitive: script execution inside the victim's workstation context.
How it was found — exploitation steps
- Identify the victim's subdomain. Create a workstation, copy the "Share Preview Link", and remove the
9000-prefix to reveal the IDX domain structure. - Set up the attacker's workstation the same way — own preview link, prefix removed.
- Prepare the malicious scripts:
script1.jspointing at the victim domain,script2.jspointing atscript1.js, andxss.ipynbpointing atscript2.js. - Upload the IPython notebook (
xss.ipynb) to the attacker's workstation and note the file path. - Host the exploit page —
exploit.htmlwith the proper variables filled in — and send the link to the victim. - Victim interaction: the victim clicks, and the attacker can read local files (for example
/etc/passwd) — with escalation to RCE from there.
How XSS escalates to RCE
- The attacker creates the XSS in
*.cloudworkstations.googleusercontent.com. - A login CSRF logs the victim into the attacker's IDX workstation.
- Using the XSS, the attacker iframes the victim's IDX subdomain.
- Forged postMessages execute JavaScript in the victim's workspace.
- The result: full access to files, commands, and GCP tokens.
Impact
- Arbitrary JavaScript execution in a victim's IDX workstation.
- Remote code execution inside the cloud dev environment.
- Leakage of gcloud tokens with full
cloud-platformscope — potential compromise of the victim's Google Cloud projects.
The fix, and the lesson
The deeper root cause was architectural: the iframe was hosted on the same origin as the main Code OSS UI. The fix direction is the one GitLab and Microsoft use — host webWorkerExtensionHostIframe.html on a separate origin, validate postMessage origins strictly and never from attacker-controllable input, and avoid leaking workstation subdomains through referers or unencrypted DNS. Small origin-handling mistakes in cloud IDEs don't stay small — they become RCE and token theft.
Found something similar?
I help teams verify and fix issues like this — and I retest my own reports for free. Reach me at sr558079@gmail.com or read more writeups.