Skip to content
OAuth / SSO Write-up Intermediate

SSH key injection in Google Cloud Compute Engine [Google VRP]

The OAuth authorisation endpoint for Cloud Workstations trusted a base64-encoded state parameter whose target_host field could be manipulated to point at an attacker domain, leaking the workstation JWT. Because the state value was not tied to a session, an attacker could generate a valid one and send a crafted link that handed them a victim's workstation token.

Sivanesh Ashok Follow

Published on blog.stazot.com

Bounty$6,000 View original

This write-up is a part of a series of write-ups about the bugs I and Sreeram found in Google Cloud in 2022.

Sivanesh Ashok, on blog.stazot.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

Likely the authorisation endpoint validated the target_host by checking it contained a valid workstation hostname rather than parsing it as a URL and comparing the host exactly, and the state parameter was not bound to the user's session.

Impact

An attacker could obtain a victim's workstation JWT and log in to that user's Cloud Workstation, though the victim had to click a crafted link.

What the attacker needed

Victim clicks a crafted link; attacker has a GCP project with a workstation

How it was found

  1. Attacker visits the victim's workstation subdomain and is redirected to the authorisation endpoint, receiving a 500 error but a valid state value.
  2. Attacker base64-decodes the state parameter and changes target_host to an attacker domain followed by the victim hostname.
  3. Attacker re-encodes the JSON to base64 to build a new state value and crafts the authorisation URL with it.
  4. Attacker sends the crafted link to the victim.
  5. When the victim follows the link, the server redirects to the attacker domain and leaks the workstation JWT.

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.

When you log in to a web app, the server often hands your browser a short-lived token that proves who you are. Here the login flow put that token in a redirect URL, and the destination was taken from a value the attacker could edit. So a victim who clicked a prepared link would send their token to the attacker's site, letting the attacker act as them.

What is OAuth / SSO?

Mistakes in OAuth, OpenID Connect, SAML or token handling that leak codes and tokens or link an attacker's identity to a victim's account.

More by Sivanesh Ashok

View all

1 more disclosed report, 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.

OAuth and single sign-on flaws

The lesson behind this report.

Mistakes in OAuth, OpenID Connect, SAML or token handling that leak codes and tokens or link an attacker's identity to a victim's account.