Security & Authentication

How Two-Factor Authentication Actually Works — and Which Methods Are Actually Secure

Two-factor authentication is one of the most recommended security practices — but not all 2FA methods offer equal protection. SMS codes, authenticator apps, hardware keys, and passkeys all work differently and have distinct vulnerabilities. Here's the complete breakdown.

✍ By ⏱ 10 min read
In This Guide
  1. What Two-Factor Authentication Is
  2. The Three Authentication Factors
  3. Every 2FA Method Ranked by Security
  4. Phishing-Resistant 2FA: What That Means
  5. Passkeys: The Next Step Beyond 2FA
  6. The Recovery Code Problem
  7. Which 2FA to Use Where

What Two-Factor Authentication Is

Two-factor authentication (2FA) — also called multi-factor authentication (MFA) — requires two separate proofs of identity to log into an account rather than just a password. The logic: a password alone can be stolen, guessed, or leaked. A second factor that's harder to steal — something you physically have or something biometrically unique to you — makes account compromise significantly more difficult even when passwords are compromised.

According to Microsoft's security research, accounts with MFA enabled are more than 99% less likely to be compromised than accounts using only passwords — even with relatively weak 2FA methods. The difference between weak and strong 2FA matters primarily for high-value targets, but the baseline protection from any 2FA is substantial. Source: CISA Multi-Factor Authentication.

The Three Authentication Factors

2FA combines two of these categories. The most common combination is "something you know" (password) + "something you have" (code delivered to or generated by your phone).

Every 2FA Method Ranked by Security

Hardware Security Keys (FIDO2/WebAuthn)Strongest
A physical USB, NFC, or Bluetooth device (YubiKey, Google Titan Key) that performs cryptographic authentication. At login, you insert or tap the key; it generates a cryptographic response to a challenge from the server. The private key never leaves the device and is tied to the specific site's domain.
Vulnerabilities: Physical loss of the key. Requires keeping a backup key. Phishing-resistant — cannot be tricked into authenticating on a fake site because the domain is cryptographically verified.
Passkeys (Device-Bound FIDO2)Strongest
Passkeys store a private key on your device (or synced via iCloud Keychain / Google Password Manager) and use biometric or device PIN to authorize authentication. They're phishing-resistant by design — the key is tied to the site's domain, so a fake site can't use your passkey.
Vulnerabilities: Depends on device security. Synced passkeys depend on the security of your Apple ID or Google account. Still more secure than any code-based 2FA method.
Authenticator App (TOTP)Strong
Apps like Google Authenticator, Authy, or Apple Passwords generate time-based one-time passwords (TOTP) — 6-digit codes that change every 30 seconds. These are generated locally using a shared secret established at setup and don't require cellular service or internet.
Vulnerabilities: Susceptible to real-time phishing — an attacker operating a fake login page can prompt you for the code and relay it to the real site before it expires (a "real-time phishing" or AiTM attack). Significantly better than SMS but not phishing-resistant.
Push Notification Approval (App-Based)Moderate–Strong
A notification appears on your phone asking you to approve or deny a login attempt. Approve with a tap. Used by Microsoft Authenticator, Duo, and similar enterprise authentication apps.
Vulnerabilities: Susceptible to "MFA fatigue" attacks — an attacker who knows your password can send repeated push notifications until you accidentally approve one or approve out of frustration. Number matching (requiring you to match a code displayed on the login screen in the push notification) mitigates this significantly.
Email OTPModerate
A one-time code sent to your email address. Security is entirely dependent on the security of your email account. If your email account is compromised, email OTP provides no additional protection.
Vulnerabilities: Email account compromise eliminates protection. Subject to real-time phishing. Better than no 2FA; significantly weaker than authenticator apps or hardware keys.
SMS / Text Message CodeWeakest
A code sent via text message to your phone number. Widely supported and better than no 2FA, but the weakest form of second-factor authentication due to the vulnerabilities of the SMS system itself.
Vulnerabilities: SIM swap attacks allow attackers to take over your phone number. SS7 protocol attacks can intercept SMS at the carrier level. Real-time phishing can relay codes. Despite being the most common 2FA method, it's the least secure.

Phishing-Resistant 2FA: What That Means

Most 2FA methods — including SMS and authenticator apps — can be defeated by sophisticated phishing attacks where an attacker operates a fake login page that proxies your credentials and 2FA codes to the real site in real time. You enter your password and code on the fake site; the attacker relays them to the real site immediately and logs in as you before your code expires.

Phishing-resistant 2FA is specifically designed to be immune to this attack. Hardware security keys and passkeys are phishing-resistant because the cryptographic response they generate is tied to the specific domain of the login site. A fake site at "secure-google-login.com" requesting your YubiKey response gets a cryptographic response tied to "secure-google-login.com" — which the real Google server will reject because it's not "google.com." The domain verification is automatic and cryptographic — you don't have to notice that you're on a fake site. Source: CISA.

Passkeys: The Next Step Beyond 2FA

Passkeys combine authentication factors in a way that makes the "two-factor" framing somewhat obsolete. A passkey login uses your device (something you have) and biometric verification (something you are) — and because it's phishing-resistant and passwordless, it eliminates the most common attack vectors simultaneously. Major platforms including Apple, Google, Microsoft, and most major services now support passkeys. Where available, passkeys are the recommended authentication method. Source: CISA.

The Recovery Code Problem

Most 2FA setups provide recovery codes — a set of one-time-use backup codes for accessing your account if you lose your 2FA device. These recovery codes are single-factor authentication — they bypass 2FA entirely. If an attacker obtains your recovery codes (through a data breach, a compromised cloud storage location where you saved them, or a phishing attack), they can access your account without your password or 2FA device.

Recovery codes should be stored offline (printed on paper or written down) in a physically secure location — not in a cloud notes app, email, or screenshot. Source: CISA.

Which 2FA to Use Where

🎯 Bottom Line

All 2FA is better than no 2FA — but the gap between the weakest and strongest methods is significant. SMS codes can be bypassed via SIM swap or real-time phishing. Authenticator apps are meaningfully stronger but still susceptible to sophisticated phishing. Hardware keys and passkeys are phishing-resistant by design — the cryptographic domain binding makes fake login pages technically unable to use your authentication response. For your highest-value accounts — especially email — the method matters. For average accounts, any 2FA implementation reduces your risk dramatically compared to password-only access. Source: Cybersecurity and Infrastructure Security Agency.