Skip to content
OAuth / SSO Write-up Advanced

Confused Deputy Google Idp Universal Account Takeover Via Device Code Flow Hijacking

Google's OAuth device authorization flow allowed a sign-in session to be transferred between browsers and failed to bind the client_id and scope to the device_code, so an attacker could craft a link that, when opened by a victim, silently issued an access token for an arbitrary Google client with elevated scopes. This enabled account takeover on any site using Sign in with Google, including full Gmail access via IMAP.

Mohamed Benchikh Follow

Published on infosecwriteups.com

This one started from setting up the YouTube app on my PS5. The device authorization grant (RFC 8628) it uses, the flow TVs, consoles, and CLIs rely on when they don’t have a browser of their own, turned out to hide two stacked bugs in Google’s implementation.

Mohamed Benchikh, on infosecwriteups.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 authorization server did not bind the client_id and scope to the device_code at issuance and did not prevent the sign-in session from being transferred to another browser.

Impact

An attacker could silently take over a victim's account on any application using Sign in with Google, including full Gmail access via IMAP, with no consent screen, no 2FA prompt, and minimal audit trail.

What the attacker needed

Victim has a Google account; victim opens a crafted link; attacker can initiate a device flow

The fix

The vulnerability was fixed by binding client_id and scope to the device_code server-side and preventing session transfer, as indicated by the report being marked fixed.

How it was found

  1. Start a device authorization flow on a device (e.g., PS5) to obtain a device_code and user_code.
  2. On a separate browser, go to the verification URL, enter the user_code, and proceed to the sign-in challenge page.
  3. Copy the challenge URL (containing the TL parameter) and open it in a second browser.
  4. Sign in with a Google account in the second browser; the device polling with the original device_code receives an access token for that account.
  5. Modify the challenge URL by replacing the client_id and scope with those of a different Google client (e.g., Cloud SDK with cloud-platform scope).
  6. Open the modified URL in a victim's browser (optionally with prompt=none) to silently obtain a token for the victim's account under the substituted client and scopes.

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.

OAuth is a way for apps to let you sign in with an account from another service, like Google. The device flow is used by devices without a browser, like a TV, where you type a short code on your phone to log in. The bug meant that the link used to finish that login could be given to someone else, and the app and permissions in that link could be changed to something more dangerous, so opening a crafted link could give an attacker access to your account without you noticing.

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 Mohamed Benchikh

View all

2 more disclosed reports, best first.

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.