root@thehacksparrow:~/writeups$ SYSTEM ONLINE
root@sparrow:~/writeups$ cat vulnerability-pattern-oauth-auth.md
// bug-bounty

OAuth & Authentication Flaws

23 Jul 2026 · 3 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
    ,
    /connect/authorize
    endpoint with
    client_id
    /
    redirect_uri
    /
    state
    parameters

How I test it

  1. Map every 'alternate path' in the auth flow: forgot password, no access to email, resend code, expired code, login with Google/SSO.
  2. Test reset-token reuse across sessions, reusing a token from one account on another, changing email without confirmation, changing password without the current one.
  3. For OAuth: capture the request containing
    redirect_uri=
    , decode it, and try subdomain swaps, the
    @
    trick (
    https://trusted.com@attacker.com
    ), fragment tricks (
    https://attacker.com#@trusted.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.
  4. 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