When untrusted callers cross a trust boundary, WebAuthn & FIDO2 Passwordless Auth, because the browser—not the user—supplies the verified origin into the signed challenge, even a pixel-perfect reverse-proxy phishing site cannot replay a WebAuthn assertion.
TL;DR30-second simplified summary▾
During registration, the Relying Party issues a CSPRNG challenge and rpId, and the authenticator generates a scoped keypair inside its Secure Enclave/TPM. During login, the authenticator signs authenticatorData || sha256(clientDataJSON).
Because the browser injects the real TLS origin into clientDataJSON, AiTM phishing proxies cannot replay assertions. Production backends must consume challenges atomically (GETDEL) and exempt signCount == 0 for cloud-synced passkeys.
alg, kid, jku), skip audience/issuer checks, or confuse asymmetric public keys with HMAC secrets.Why Passwords and TOTP Fail Against Reverse-Proxy Phishing.
Why this matters: Establish why shared-secret MFA cannot stop real-time adversary-in-the-middle proxies, whereas origin-bound signatures do.
Even with 6-digit TOTP or SMS codes, an Adversary-in-the-Middle (AiTM) reverse proxy sits between the victim and the legitimate login page, forwarding the username, password, and OTP in real time and stealing the resulting session cookie.
FIDO2/WebAuthn defeats AiTM phishing because the browser enforces origin binding: the authenticator signs the TLS origin observed by the browser (https://evil-login.com), which never matches the legitimate Relying Party's expected origin (https://example.com).
Why Passwords and TOTP Fail Against Reverse-Proxy Phishing
The WebAuthn Registration Ceremony (Attestation).
Why this matters: Trace how a Relying Party issues a challenge and persists a scoped public key without ever seeing a private key.
1.
Server Challenge: RP generates a 32-byte CSPRNG challenge, stores it in short-lived state (e.g., Redis with 5-minute TTL), and specifies rp.id, user.id, and allowed algorithms (-7 ES256, -8 EdDSA). 2. Browser & Authenticator: navigator.credentials.create() invokes the platform authenticator (Touch ID, Windows Hello, Android Biometrics) or roaming key.
WebAuthn Registration Data Flow
- Problem
- How to implement Passkeys, WebAuthn & FIDO2 Passwordless Auth without hitting unbounded tail latency, state divergence, or operational fragility.
- Naive Solution
- Use a single unpartitioned path with unbounded retries and synchronous global coordination.
- Why It Fails
- Global coordination serializes throughput under load, while unbounded retries amplify transient stalls into full outages.
- Alternatives
- Compare synchronous strict-consistency paths against bounded asynchronous replication, local caching, or partitioned ownership.
- Engineering Decision
- When untrusted callers cross a trust boundary, webAuthn & FIDO2 Passwordless Auth, because the browser—not the user—supplies the verified origin into the signed challenge, even a pixel-perfect reverse-proxy phishing site cannot replay a WebAuthn assertion.
- Trade-Offs
- Gains predictable p99 latency and fault isolation in exchange for explicit bounding, observability, and slightly higher implementation complexity.
When Passkeys, WebAuthn & FIDO2 Passwordless Auth experiences a sudden 5x traffic spike alongside a slow downstream dependency, which engineering choice best protects system stability?
Assertion Verification, Origin Binding & Replay Protection.
Why this matters: Walk through every cryptographic check the server must perform on a WebAuthn login assertion.
When signing in, navigator.credentials.get() returns authenticatorData, clientDataJSON, and signature.
The RP server must verify all of the following in order:
- Challenge:
clientDataJSON.challengematches the stored single-use challenge (and delete it immediately to prevent replay). - Origin & Type:
clientDataJSON.type === 'webauthn.get'andclientDataJSON.originmatches your exact allowlisted HTTPS origin. - RP ID Hash: First 32 bytes of
authenticatorDataequalsha256(expectedRpId). - Signature: Verify
signatureoverauthenticatorData || sha256(clientDataJSON)using the stored COSE public key.
Assertion Verification, Origin Binding & Replay Protection
Safe Challenge Lifecycle & Assertion Verification with Atomic Consumption.
Why this matters: Implement replay-safe challenge consumption and signature validation with explicit failure handling and signCount rules.
Always consume challenges atomically (GETDEL in Redis) so concurrent replay attempts fail immediately, and handle synced passkeys (signCount == 0) properly:
import hashlib, json, base64
def verify_assertion(redis_client, session_id, assertion, stored_cred, expected_origin, expected_rp_id):
# 1. Atomically consume single-use challenge (prevents replay race conditions)
expected_challenge = redis_client.getdel(f'webauthn:chal:{session_id}')
if not expected_challenge:
raise AuthError('Challenge missing, expired, or already consumed')
client_data = json.loads(base64.urlsafe_b64decode(assertion['clientDataJSON'] + '=='))
if client_data.get('type') != 'webauthn.get' or client_data.get('origin') != expected_origin:
raise AuthError('Origin or ceremony type mismatch (possible phishing proxy)')
if client_data.get('challenge') != expected_challenge:
raise AuthError('Challenge mismatch')
auth_data = base64.urlsafe_b64decode(assertion['authenticatorData'] + '==')
if auth_data[:32] != hashlib.sha256(expected_rp_id.encode()).digest():
raise AuthError('RP ID hash mismatch')
# 2. Verify cryptographic signature over auth_data || sha256(clientDataJSON_raw)
if not verify_cose_signature(stored_cred.public_key, auth_data, assertion['clientDataJSON'], assertion['signature']):
raise AuthError('Invalid WebAuthn signature')Resident (Discoverable) Keys vs. Enterprise Hardware Keys.
Why this matters: Compare cloud-synced passkeys and hardware-bound FIDO2 keys across recovery, UX, and enterprise attestation.
- Synced Passkeys (Multi-Device): Stored in iCloud Keychain, Google Password Manager, or 1Password;
BE(Backup Eligible) andBS(Backed Up) flags are1.
Great for consumer UX because losing a phone does not lock out the account. - Device-Bound Keys (Single-Device): YubiKeys or enterprise TPMs where BE=0.
Preventing Lockout Without Weakening Security.
Why this matters: Design multi-passkey enrollment and high-assurance recovery flows so fallback channels do not become the weakest link.
If a user registers a single hardware key and loses it, falling back to an unverified SMS reset reintroduces SIM-swap risk.
Best practices:
- Encourage 2+ passkeys (e.g., platform passkey + backup security key or synced password manager).
- Use WebAuthn Conditional UI (
mediation: 'conditional') for one-tap autofill login. - Gate recovery with high-entropy recovery codes or identity-verified re-enrollment delays.
Subdomain rpId Scope, signCount=0 False Positives & Browser Quirks.
Why this matters: Avoid common production outages caused by misconfigured rpId domains or naive signCount checks.
rpIdDomain Mismatch: SettingrpIdtologin.example.comprevents credentials from working onapp.example.com.
Use the registrable domain (example.com) if passkeys span subdomains—but never a public suffix. - False Cloned-Key Lockouts: Multi-device synced passkeys intentionally emit signCount = 0.
Practice: Make the trade-off yourself.
An employee clicks a link to `https://corp-sso-login.com` (an AiTM reverse proxy for `https://sso.corp.com`) and taps their FIDO2 passkey. Why does the login fail?