November 16, 2026
I Steal Your Login With One Query Parameter: My OAuth Account-Takeover Playbook

By The XSS Rat
7 min read
The "Sign in with Google" button is the softest target on most apps. Here's the exact order I break it โ redirect_uri, state, and the pre-account-takeover.
Here is a bug that lives in almost every serious application and that most hunters walk straight past: the "Sign in with Google" button. It feels like infrastructure. It feels like Google's problem, not the app's. That feeling is exactly why OAuth is where I go when a target looks hardened everywhere else.
OAuth doesn't fail because the cryptography is weak. It fails because developers bolt a login protocol onto an app by copying three query parameters off a blog post and trusting that the library does the rest. The library doesn't. The glue between the provider and the app is hand-written, under-tested, and reachable by anyone with a browser. That glue is where I take over accounts.
This is the exact order I work a login flow. No theory for its own sake โ just the checks, in sequence, that have handed me account takeovers on real programmes. Everything here is for your own targets, deliberately vulnerable labs, or an app you're authorised to test. Point it at anything else and you're not a hunter, you're a defendant.
First, the dance โ because you can't break what you can't draw
Every bug in this article lives in one of five steps. If you can't sketch the round-trip from memory, you'll miss them, so burn this in first.
The authorisation-code flow has three actors: the victim's browser, the client app (the thing you're logging into), and the provider (Google, GitHub, an enterprise SSO). The app bounces the user to the provider with a bundle of parameters, the user approves, and the provider bounces them back carrying a short-lived code. The app then swaps that code for an access token on a back channel and issues you a session.
The whole security model rests on one assumption: that the code only ever reaches the real app. Break that assumption โ make the code land in a browser or a server I control โ and the account is mine.
The authorisation-code flow, and the five places I attack it. Every red box is a spot where I try to redirect the secret into my hands.
redirect_uri: the parameter that pays the rent
Start here. Always. redirect_uri tells the provider where to send the user โ and the code โ after they approve. If I can make it point somewhere I control, the provider will cheerfully hand my code the victim's authorisation.
Providers are supposed to check this value against a registered whitelist. In practice the client app often does its own sloppy validation on top, and that's the matcher I attack. I'm not breaking a signature; I'm breaking a string comparison some developer wrote at 5pm on a Friday.
The ritual: open the login request in Burp or Caido, find redirect_uri, and start bending it. Does the check want the value to start with the real domain? Then https://app.com.attacker.com sails through. Does it want the value to merely contain the domain? https://attacker.com/?x=app.com or the classic https://app.com@attacker.com userinfo trick will do it. Is the host locked but the path loose? Hunt for an open redirect on the app itself and chain it โ the code lands on an allowed host, which then forwards it, fragment and all, to me.
My redirect_uri bypass cheat sheet. I work top to bottom against whatever matcher the app is using.
Two bypasses punch above their weight. First, subdomain scope: if the whitelist allows *.app.com, I don't need to escape the domain at all โ I need one XSS or one forgotten, dangling subdomain anywhere on it, and I exfiltrate the code from inside the trust boundary. Second, path traversal into an open redirect, which turns "exact host required" from a wall into a speed bump. When a target says its redirect validation is airtight, these two are where I keep digging.
state: the one-line check nobody writes
The state parameter is a CSRF token for the OAuth round-trip. It should be a random value, tied to the victim's session, checked when they come back, and thrown away after. Developers treat it as optional decoration. It is not optional โ it's the thing standing between you and login CSRF.
Here's the attack when state is missing, static, or not actually bound to a session. I start the OAuth dance myself and capture my own valid code before it's spent. I stop. Then I deliver that callback URL to the victim. Their browser completes my login, and now they're sitting inside my account โ typing in their home address, linking their card, uploading documents โ all landing in an account I own and can read at leisure. The reverse works too: on a "link your Google account" feature, I can bind my social identity onto the victim's existing session, giving me a permanent key to their account.
To test it, grab a fresh callback, remove or fix the state value, and replay it in a different browser session. If it completes without complaint, state isn't doing its job.
Same login button, two different takeovers. One steals the code in transit; the other claims the account before the victim arrives.
Pre-account-takeover: owning the account before the victim exists
This is my favourite OAuth bug because it needs no fancy parameter tampering โ just patience and a flaw in how the app links identities.
Loads of apps let you register the old-fashioned way with an email and password and "Sign in with Google". The question I always ask: when someone signs in with Google using an email that already has a local account, what does the app do? If the answer is "links them together because the email matches" โ without ever verifying that the person controls both โ it's game over.
So I register a normal account with victim@company.com, set a password I know, and wait. Eventually the real owner shows up and clicks "Sign in with Google". The app sees a matching email and merrily links their Google login to my pre-seeded account. Now we both have keys: they log in via Google, I log in with the password I set months ago, and I read everything they do. No phishing, no payload โ just a logic flaw in identity linking.
The sibling of this bug is the unverified-email takeover. Some providers, and some self-hosted SSO setups, let you present an email address in the token without proving you own it. If the app trusts that email as identity, I sign in "as" the victim directly. Always check whether the app treats the provider's email claim as gospel.
Stealing the code when the redirect is almost right
Sometimes redirect_uri is locked down but the code still leaks, because a URL carrying a secret is a secret that spreads. Three places I look. The Referer header: if the callback page loads any third-party script, analytics pixel, or external image, the full URL โ code and all โ can walk out in the Referer. The browser history and logs: codes in the query string get cached, logged, and bookmarked in places they shouldn't live. The implicit flow: if the app uses response_type=token, the access token itself rides back in the URL fragment โ far juicier than a one-time code, and far easier to leak the same ways.
And don't forget the code is a one-time value for a reason. If the app lets the same code be redeemed twice, or doesn't expire it quickly, a leaked code that looked spent is suddenly live again. Test the replay. You'd be amazed how often it works.
Prove it, don't just claim it
This is where most OAuth reports die on the triage desk. "The redirect_uri reflects my domain" is not a finding โ it's a hypothesis. A reflection earns a shrug and a "won't fix". You have to climb the ladder.
The state parameter in one picture, and the impact ladder every OAuth report has to climb to get paid.
So walk the whole chain and capture each rung. Show the crafted authorisation request. Show the code actually arriving on a host you control โ a request log on your own server is worth a thousand words. Show the code being replayed into the real callback and a session being minted as the victim. Then show the impact: read their data, change their email, pivot to something that makes a security team's stomach drop. Two test accounts you own, start to finish, a clean screen recording, and a one-line remediation ("bind state to the session and reject on mismatch"; "exact-match redirect_uri, no wildcards"). That's the difference between a "won't fix" and a bounty that makes your week.
Where to actually practise this
You will not learn OAuth by reading about OAuth. You learn it by breaking a flow you're allowed to break, over and over, until the five steps are muscle memory and your hands reach for redirect_uri before your brain finishes reading the request.
That's exactly what I built RatPack Park for โ a lab full of deliberately broken targets where you can run this entire playbook end to end without a single authorisation worry. Want it to count toward something? My CMWAP certification (Certified Mobile and Web Application Penetration-tester) is built around this exact impact-first, methodology-driven way of hunting โ not memorising payloads, but knowing which wall to push and how to prove it caves. And if you like working under pressure, come break things with the rest of us at RatCTF. If you want me looking over your shoulder as you go, that's what my coaching is for.
Go find the login button. It's softer than it looks.
About the author. I'm Wesley Thijs โ The XSS Rat. I've taught over 200,000 students the practical, methodology-first way to hunt bugs, I run bug bounty coaching and the Rat Pack community, and I spent years in QA and test automation before this, which is exactly why I think in terms of "what is this feature trying to stop me doing, and how do I do it anyway?" Catch me on YouTube and X, where I break down bugs like this one every week. Hunt ethically, hunt relentlessly, and always get it in writing before you touch a target.