Caloogy Article
中文

Passkey: Why It Is Inherently Phishing-Resistant

Date
Dec 17, 2025
Series
Web Security
Reading
4 min
Topics
PasskeyWebauthnFido2Phishing

The one-sentence version

The problem with passwords and SMS verification codes is that they are secrets that can be copied; users will still type them into a fake website. Passkeys (WebAuthn / FIDO2) take a different approach: a private key is stored on the device, and during login, the device only signs a random challenge sent by the server, and that signature explicitly states "I am signing this on this specific website." A fake website only receives a signature that is valid for that fake website; if passed to the real website, it becomes invalid. Therefore, a passkey is not just "harder to trick," it is structurally impossible to phish.

This article has three layers:

  1. Layer 1: The Intuition: Keys and locks, and why verification codes get stolen.
  2. Layer 2: Real-World Use: Who is using them, real phishing attack data, and "re-verifying for sensitive operations."
  3. Layer 3: Principles and engineering key points: Registration and login flows, origin binding, and signature counters.

Layer 1: The Intuition

1.1 Why Passwords Always Cause Trouble

Method Essence How it is stolen
Password A secret shared between you and the website Credential stuffing, phishing pages, keyloggers, website database leaks
SMS Verification Code A one-time shared secret Real-time forwarding via phishing pages, SIM swapping, social engineering via customer service
App Verification Code (TOTP) A one-time secret calculated from a shared seed Real-time forwarding via phishing pages

Their common weakness is: What you know, you can also tell someone else. A phishing website looks exactly like the real one; you type it in, and it immediately forwards it to the real website in the background—the whole process takes less than a second.

1.2 Passkey: You Don't Need to "Know" Anything

A Passkey is more like a key that only turns in the correct lock:

The most critical point: Before signing, the browser writes the current website's domain into the content being signed. If you scan your fingerprint on examp1e.com (a fake website), the signature will state examp1e.com; if you take that signature to the real website example.com for verification, it will definitely fail.


Layer 2: Real-World Use

2.1 Re-verifying for Sensitive Operations (step-up authentication)

After logging in once, a session may last for several days. If someone borrows your computer or a session cookie is stolen, they can act as you. Therefore, high-value operations (transfers, changing payout addresses, changing notification emails) should require a passkey again on the spot. Using a fingerprint during a bank transfer is an application of this concept.


Layer 3: Principles and Engineering

3.1 Registration

Website ServerBrowserUser Device (Authenticator)Website ServerBrowserUser Device (Authenticator)Random challenge + Relying Party ID (rpId)Generate a new key pair (for this rpId only)Public key + credential ID + signatureSend along with clientDataJSON (containing origin)Verify challenge, origin, and store public key

3.2 Authentication

The server sends a new random challenge. The content signed by the device is:

sig=Signsk(authenticatorData ∥ SHA256(clientDataJSON)),\text{sig} = \mathrm{Sign}_{sk}\big(\text{authenticatorData} \,\|\, \mathrm{SHA256}(\text{clientDataJSON})\big),

Where clientDataJSON contains challenge, origin (such as https://example.com), and the type; authenticatorData contains the hash of the rpId, the "User Present / User Verified" flag, and the signature counter. The signature algorithm is typically ECDSA on P-256 (see "Elliptic Curves").

The server must check:

Check Item Prevents
Challenge is recently issued and used only once Replay of old signatures (see "Signature Login and Anti-Replay")
Origin and rpId match its own domain phishing: The signature obtained by a fake website won't match
User Verified (UV) flag Confirms that a fingerprint was actually scanned / a PIN was entered, rather than just "device presence"
Signature matches the stored public key Impersonation
Signature counter increments Detection of cloned hardware keys (syncable passkey counters are often 0 and require compatibility)

3.3 Why Server Leaks Are No Longer a Threat

The server only stores the public key. If the database is stolen, the attacker gets a pile of public keys, which can neither be used to log in nor used for credential stuffing. This is fundamentally different from passwords (even salted hashes).

3.4 Engineering Pitfalls


Summary

Layer Key points
Intuition There is no secret to input, so naturally, there is no secret to be phished
Principles Public key signature + signature content bound to origin; server only stores public keys
Usage Beyond login, re-verify for sensitive operations (step-up)
Pitfalls Recovery processes, security of synced accounts, and avoiding downgrades to SMS