OWASP Multi-Factor Authentication
Passwords leak, repeat across sites, and fall to guessing. Multi-factor authentication, or MFA, asks for a second proof of identity after the password. Stolen passwords alone no longer open the account, which makes MFA one of the most effective protections available to everyday users and companies.
Three Kinds of Proof
| Factor | Meaning | Examples |
|---|---|---|
| Something you know | A secret in your memory | Password, PIN |
| Something you have | A physical item you hold | Phone, security key, smart card |
| Something you are | A body trait | Fingerprint, face scan |
True MFA combines two different factors. Two passwords still count as one factor.
The Bank Vault Comparison
A bank vault needs a key and a code. A thief who steals the key still cannot open the door. A thief who learns the code still lacks the key. MFA builds the same double barrier around an account.
Login Flow With MFA
User enters password
|
↓
+------------------+ wrong +-----------+
| Password correct?| ———————————→ | Rejected |
+------------------+ +-----------+
| yes
↓
Server asks for second factor
|
↓
+------------------+ wrong +-----------+
|Code or key valid?| ——————————→ | Rejected |
+------------------+ +-----------+
| yes
↓
New session starts → Access granted
Common MFA Methods
Authenticator App Codes
Apps generate a six-digit code that changes every 30 seconds. The code comes from a shared secret and the current time, a method called TOTP. Codes work offline and cost nothing.
Security Keys and Passkeys
Hardware keys and passkeys use the FIDO2 and WebAuthn standards. The device signs a challenge that belongs to the real website only. Fake login pages receive nothing useful, so these methods resist phishing best.
Push Approvals
The phone shows an approval prompt. Convenient and fast, push approvals carry a risk called prompt bombing, where attackers send repeated prompts until a tired user taps Approve. Number matching reduces that risk.
SMS Codes
Text messages reach nearly everyone, yet attackers can intercept them through SIM swap fraud. Treat SMS as better than nothing and weaker than the other options.
Strength Ranking
Strongest Passkeys / security keys
↑ Authenticator app codes
| Push with number matching
| SMS or email codes
Weakest Password only
Designing MFA Safely
- Require MFA for administrators and for all access to sensitive data first.
- Offer more than one method so users keep access when a phone breaks.
- Generate one-time recovery codes at enrollment. Show them once and store only hashed copies on the server.
- Limit attempts on code entry and lock or slow the account after repeated failures.
- Expire codes quickly and reject reuse of a code already accepted.
- Notify users by email when they add, remove, or change an MFA method.
- Apply the same MFA checks to password reset and account recovery paths. Attackers love the weakest door.
Common Mistakes
- Letting a user skip MFA through a hidden or old login endpoint.
- Reusing the session identifier from before the second step.
- Leaving recovery by email as a simple bypass.
- Accepting unlimited code guesses.
Key Takeaways
- MFA combines two different kinds of proof.
- Phishing-resistant methods, such as passkeys, offer the strongest protection.
- Recovery and reset flows need the same care as the main login.
- Rate limits and alerts keep MFA from becoming a new weak point.
