MFA and password reset: weak points beyond the password
MFA is broken through the process around it, not the maths of the code. The server issues a session before the second step, does not limit code attempts or accepts a weaker fallback. Password reset must be no weaker than login: the token is random, single-use and short-lived, and the link is not built from the Host header. Against notification fatigue, number matching and passkeys help.
Pentest · Authentication
The login is protected by MFA and the account is still taken over. Through which back door?
A team enabled two-factor authentication and thinks the accounts are protected. But there are several doors to an account: the login form itself, the second step, the “forgot password” button, support. An attacker picks the weakest. This lesson covers typical mistakes of the second factor and of password reset: the places where authentication is broken most often without touching the password.
How it works and why. MFA combines at least two different kinds of factor: knowledge (a password), possession (a phone, a key), inherence (biometrics). The weakness is almost never in the mathematics of the one-time code but in how the server runs the process. Typical defects of the second step:
- Skipping the step: after the password the server has already issued a session and merely shows the MFA page; a direct request to
/dashboardworks; - No attempt limit: a six-digit code has a million variants and without a limit it is enumerated;
- The code is not bound to a session or time: the same code is accepted twice or for another account;
- A weaker fallback: SMS or an e-mail “if you have no app” or “remember this device” bypasses the strong factor;
- Trusting the client: a flag
mfa=truein the request or cookie.
A separate attack is MFA fatigue: an attacker who already knows the password sends dozens of push requests until the user taps “Approve”. Defence: number matching, a request limit, turning push off in favour of codes and best of all passkeys (FIDO2/WebAuthn) bound to the real domain.
Example: skipping the MFA step. After the correct password the application redirects to the code page:
POST /login
HTTP/1.1 302 Found
Location: /mfa
Set-Cookie: sid=A1; HttpOnly
The tester does not enter the code and requests a protected page with the received cookie:
GET /dashboard HTTP/1.1
Cookie: sid=A1
If the answer is 200 with data, the session was issued before the second step and MFA works only on the screen. The right design: until the code is entered the session is only “partially authenticated” and the server refuses (302 to /mfa or 401) on any protected address.
Password reset. This is another path to the account, so it must be no weaker than login. The diagram shows where the checks sit.
Password reset and where it gets broken
Typical defects: the token is predictable (depends on time, a number or the user id), has no expiry, works many times or is stored in clear; the response to the request gives away whether the e-mail exists; the link in the e-mail is built from the Host header (host header poisoning); a token in the URL leaks in Referer to third-party sites; old sessions remain after the password change; the code is short with no attempt limit.
Checking host header poisoning on a test system:
POST /forgot-password HTTP/1.1
Host: evil.example
Content-Type: application/json
{"email":"test-user@shop.example"}
If the test user’s e-mail contains a link to https://evil.example/reset?token=…, then a victim who clicks it hands the token to the attacker. The link is built from fixed configuration (the application’s own domain), not from the incoming request.
Real cases. In September 2022 Uber suffered an MFA fatigue attack: according to the company, the attacker likely bought the contractor’s password on the dark web and then tried to log in again and again, so the contractor kept receiving login approval requests; eventually the contractor accepted one and the attacker reached the company’s internal systems. In 2016 researcher Anand Prakash showed that on Facebook’s beta sites (beta.facebook.com) the password reset page had no limit of failed attempts, so the six-digit code (a million variants) could be enumerated; Facebook fixed the bug and paid him 15,000 dollars. Both cases are not about a weak password but about a weak process around it.
Limits and alternatives. Every factor has a price: SMS can be intercepted (SIM swap, phishing), TOTP (a code from an app) is stolen by phishing in real time, passkeys resist phishing but require a recovery plan that does not become the weak spot. The stronger the MFA, the more attractive account recovery and support become to an attacker: human procedures are checked too. Reset requirements are aligned with login requirements.
Common mistakes.
- Checking MFA only in the interface and not on the server for every protected request.
- Not limiting attempts to enter the MFA code and the reset code.
- Giving different response text in the “forgot password” form for an existing and a non-existent e-mail.
- Not ending active sessions after a password change.
Check yourself
After the password the application shows the MFA page, but GET /dashboard with the issued cookie returns 200. What is the mistake?
Answer
A full session was issued before the second factor and MFA is checked only on the screen. The server must treat the session as incomplete until the code is confirmed and refuse every protected address.
Why is “long” not enough for a password reset token: what else must it be?
Answer
Random from a cryptographic generator, one-time, with a short lifetime and bound to the user; the server stores its hash. Otherwise a long but predictable or eternal token remains vulnerable.