root@sparrow:~/writeups$ cat vulnerability-pattern-oauth-auth.md
// bug-bounty
OAuth & Authentication Flaws
23 Jul 2026
· 1 min read
What it is
Two related roads to the same outcome — full account takeover. One: broken password reset, email change, OTP verification or session handling. Two: manipulating an OAuth
redirect_uri parameter so the authorization code gets redirected to a domain you control instead of the legitimate app.Why it matters
Account takeover is consistently one of the highest-value bug classes: it's rarely 'just' one field or one resource, it's the whole account, including everything downstream of it (billing, data, other integrations).
Where to look
- Password reset, email/phone change, OTP verification, magic links, session management
- Any
,/authorize
,/oauth/authorize
endpoint with/connect/authorize
/client_id
/redirect_uri
parametersstate
How I test it
- Map every 'alternate path' in the auth flow: forgot password, no access to email, resend code, expired code, login with Google/SSO.
- Test reset-token reuse across sessions, reusing a token from one account on another, changing email without confirmation, changing password without the current one.
- For OAuth: capture the request containing
, decode it, and try subdomain swaps, theredirect_uri=
trick (@
), fragment tricks (https://trusted.com@attacker.com
), and single-vs-double URL encoding mismatches — the goal is a value the server validates as legitimate but the browser resolves to a different host.https://attacker.com#@trusted.com - Confirm end to end: does the authorization code actually land on an attacker-controlled origin, not just 'the validation message went away'?
Hunting checklist
- Two accounts to test victim/attacker roles
- Tested reset-token reuse and cross-account reuse
- Tested email/password change without the expected confirmation
- Mapped every redirect_uri-accepting endpoint
- Tried subdomain, @, fragment and double-encoding bypasses
- Confirmed the code/token actually reaches an external origin, end to end
Evidence to collect
- Original OAuth/reset request
- Modified request
- 302/301 response showing the redirect
- Final URL the browser lands on
- Proof the code/token reached the attacker's domain
Recommended fix
- Exact redirect_uri matching, no wildcard subdomains
- Normalize and decode URLs once before validating — never decode again afterward
- Invalidate all sessions on password change
- Expire and single-use reset tokens, scoped to one account