Cybersecurity

How Two-Factor Authentication Works and Why SMS Codes Are the Weakest Kind

Written by Allie Herry
Digital padlock

Your Password Will Leak. The Second Factor Is the Wall That Still Stands.

Billions of passwords from breached websites circulate permanently in attacker toolkits, and credential stuffing — software trying leaked email-and-password pairs across hundreds of services — succeeds daily against accounts whose owners did nothing wrong except reuse a password. Two-factor authentication (2FA) exists for exactly this world: it demands a second, independent proof at sign-in, so a stolen password alone buys an attacker nothing. Understanding how two-factor authentication works — the shared-secret maths behind authenticator apps, why the code changes every thirty seconds, why a text message is the weakest way to receive one, and how hardware keys and passkeys push the same idea to near-phishing-proof — turns a setting most people enable vaguely into a security architecture they can rank and apply where it counts. This guide covers the mechanism, the hierarchy of methods from weakest to strongest with the attacks each one stops or fails to stop, the honest inconvenience costs, and the upgrade order for your own accounts, crown jewels first. It builds on our online safety tips everyone should follow on every device, and pairs with our explainer on how foldable phones work — the device in your hand is now the key to everything else, which is precisely why how it proves you are you deserves a full article.

The Mechanism: A Secret You and the Server Share, a Clock You Both Trust

The commonest strong form of 2FA is the authenticator app, and its working is elegant. When you enable it, the service generates a secret key — usually shown as a QR code — which your app stores; from then on, both sides run the same small calculation (the TOTP standard): combine the secret with the current time, rounded to a thirty-second window, and produce a six-digit code. Your app shows the code for the current window; the server computes the same code for the same window; if they match, the service concludes that whoever is signing in possesses the device holding the secret — no network message between you is involved at all, which is why authenticator codes work in aeroplane mode and cannot be intercepted in transit. The thirty-second rotation limits a glimpsed code’s usefulness, servers allow a window either side for clock drift and typing time, and after a few wrong guesses the attempts lock. Compare the structure with the password: the password is a secret you know and type, travelling over the network each time and stored (hashed) on every service you use — leakable from any of them; the TOTP secret is a secret a device has, never typed, never transmitted, and held in exactly two places. Security people summarise 2FA as “something you know plus something you have” (or, with biometrics, something you are), and the TOTP design is that slogan implemented as arithmetic. Recovery codes — the printable backup list offered at setup — exist for the lost-phone case; treat them like the spare key to your house, because that is precisely what they are.

The Hierarchy: SMS, Apps, Hardware Keys, Passkeys

Not all second factors are equal, and the differences are the attacks they survive. SMS codes are the weakest legitimate option: the code travels through the phone network, where it can be intercepted through SIM-swap fraud (an attacker convinces or bribes a carrier into moving your number to their SIM — disturbingly achievable, and devastating because your number is your identity at most carriers), through malware on the phone, and through basic phishing, since a code you can read is a code you can be talked into typing anywhere. SMS still beats nothing by a wide margin — it stops mass credential stuffing completely — but for high-value accounts it should be treated as a placeholder pending an upgrade. Authenticator apps (TOTP) remove the network from the equation and defeat SIM-swap entirely; their residual weakness is real-time phishing, where a fake site relays your live code to the real site within its thirty-second life — rare, targeted, but real. Hardware security keys and passkeys close even that hole with cryptography bound to the genuine website’s address: the key will simply refuse to authenticate to a look-alike domain, making phishing not merely harder but structurally futile, and passkeys extend the same public-key design into your phone and password manager with biometric unlock. The honest costs ascend with the strength: SMS is effortless, apps demand setup and backup discipline, keys can be lost (register two) and passkeys are still spreading across services. The rational policy most security professionals actually live by: passkeys or hardware keys for the email and financial crown jewels, authenticator apps as the default everywhere else, SMS only where nothing better is offered — and every account upgraded in that order is a door an attacker must now pick individually, at cost, instead of opening wholesale with a leaked list.

The Upgrade Order: Crown Jewels First, and the Recovery Rules

Implementation has a sequence, and the sequence begins with the account that resets all the others: your primary email. Whoever controls your email can request a password reset for nearly everything attached to it, so it gets the strongest factor available to you — passkey or hardware key, plus an authenticator as fallback — before any other account is touched. Next come money accounts (banking, payment apps, investment and crypto services), then your Apple or Google identity (the key to your phone’s backups, photos and location), then social and messaging accounts (valuable to attackers for impersonation and for reaching your contacts), and finally the long tail, upgraded whenever you naturally sign in somewhere. Three disciplines keep the system from locking you out of your own life, which is the legitimate fear that stops people starting: save the recovery codes for every account at setup, stored printed or in your password manager’s secure notes — never as a photo in the camera roll the codes protect; register a second factor where offered (a backup key, a second device) before you need it; and keep the authenticator backed up through its encrypted cloud sync or an exported, safely stored copy, since a drowned phone plus no backups is the one genuinely painful story in this entire field. Do the email tonight, the money this week, and the tail as you meet it. In a world where your password has almost certainly already leaked somewhere, the second factor is not an extra feature — it is the lock itself, and the password is just the sign on the door saying whose it is.

About the author

Allie Herry

Leave a Comment