Password Reset, OTP & Magic-Link Account Takeover Testing
How manual penetration testers uncover account takeover flaws in password reset, OTP, and magic-link flows: Host header poisoning, token leaks, and parameter tampering.
Web & App Security · By Thimmagurudu Bathini, CTO · Published · 5 min read
How Secondary Auth Flows Lead to Takeover
Password reset and OTP login flows are frequent targets for account takeover because developers often treat them as secondary utilities rather than high-risk authentication boundaries. Small mistakes—like trusting the HTTP Host header or returning the OTP in an API debug field—can compromise any user account.
POST /api/auth/forgot-password HTTP/1.1
Host: attacker.example
X-Forwarded-Host: attacker.example
Content-Type: application/json
{"email": "victim@company.example"}
# Reset email must always use fixed canonical https://app.company.exampleHost Header, OTP & Token-Binding Flaws
| Recovery Mechanism | Takeover Flaw | Required Control |
|---|---|---|
| Email Reset Link | Host header injection poisons reset URL domain | Build reset URLs from fixed server-side canonical base URL |
| OTP Verification | No brute-force cap on 4–6 digit OTP or reusable code | Expire OTP after 3–5 failed attempts and 5–10 minutes |
| Parameter Tampering | Changing user_id/email in step 2 after verifying own OTP | Bind OTP/reset token strictly to one server-side user identity |
| Magic Links | Tokens logged in referrer headers or valid after password change | Use Referrer-Policy: no-referrer and invalidate on first use |
Chaining Step-1 and Step-2 State Swaps
- Test forgot-password requests with modified Host, X-Forwarded-Host, and Forwarded headers.
- Check whether OTP codes are leaked in HTTP responses, client JS state, or predictable timestamps.
- Attempt to swap the target email or user_id between OTP generation and OTP submission.
- Verify that completing a password reset invalidates all existing active sessions and refresh tokens.
Hardening Recovery Tokens & Session Revocation
Use cryptographically random single-use tokens (minimum 128 bits) bound to the target user ID, never trust client-supplied Host headers, and revoke all existing sessions on reset.
Put your login, OTP, and recovery flows through manual testing starting at ₹36,000 + 18% GST. Request a scoped proposal →
Password Reset & OTP Questions
Why do scanners miss password-reset account takeovers?
Scanners don't read email inboxes or chain multi-step state swaps between step 1 and step 2.
Are recovery flows tested in every web VAPT?
Yes, authentication, reset, OTP, and session invalidation are tested in every authenticated web and mobile assessment.