Account hijack for anyone using Google sign-in with , due to response-type switch + leaking href to XSS on login.redacted.com
A reflected XSS on the login subdomain could be combined with an OAuth response-type switch so that the authorisation code and id_token were returned in the URL fragment of an error page. Because the XSS ran on the same origin, it could read the opener window's fragment and send the code to an attacker, who then exchanged it for a session on the victim's account.
Published on github.com
History
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 OAuth client accepted a response_type of code,id_token and its callback failed on the missing state, leaving the code and token in the fragment, while a same-origin XSS allowed reading the opener's fragment.
Impact
An attacker could take over the account of any user who signs in with Google, provided the victim visits the attacker's page and the idccsrf cookie is replayed alongside the stolen code.
What the attacker needed
Victim uses Google sign-in; victim visits attacker page; existing XSS on login subdomain; attacker captures idccsrf cookie
How it was found
- Open the sign-in-with-Google URL and change response_type from code to code,id_token.
- Complete the Google flow so the browser lands on the authorisation error page with the code and id_token in the fragment.
- Open the XSS endpoint in a second window on the same origin.
- Redirect the first window to the modified OAuth URL and wait for the flow to finish.
- From the XSS window read window.opener.document.location.hash and send it to the attacker server.
- Replay the state and code against the auth callback with the matching idccsrf cookie to log in as the victim.
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 sign in with Google, the site receives a short-lived code that proves who you are. Here the site could be tricked into putting that code into part of the web address that only page scripts can read, and a separate scripting flaw on the same site let an attacker's page read it. With the code, the attacker could finish the login as the victim.
What is Account takeover?
Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.