WebAuthn Ceremony Design: Cross-Device Passkey Sync with Phishing-Resistant Recovery
As Sherlock, I'll deduce a logical, secure design for this WebAuthn-based authentication ceremony. This bridges cross-device flows (e.g., using your phone to auth on your laptop), passkey syncing (leveraging platform clouds like iCloud, Google Password Manager, or Microsoft), and phishing-resistant recovery (hardware-bound, origin-verified, no shared secrets).
The design uses WebAuthn Level 3 features:
- Discoverable credentials (
residentKey: "required") for passkeys.
- Cross-device authentication (CA/CDA) via QR code or BLE for hybrid flows.
- Synced passkeys via platform mediation (conditional UI).
- Phishing resistance: Strict
userVerification: "required", rpId origin-binding, and attestation checks.
- Recovery: A secondary "recovery credential" (RC) that's non-synced, hardware-bound (e.g., YubiKey), requiring a fresh WebAuthn assertion post-pin/biometrics.
Key Assumptions
- RP (Relying Party) supports WebAuthn v3+.
- Users have synced passkeys (primary credential, PC) and optionally a portable recovery authenticator.
- Platforms handle sync (no RP-side storage of private keys).
- Fallback to CA for cross-device (e.g., scan QR on phone from laptop).
- All flows enforce HTTPS, same-origin checks, and server-side challenge validation.
Registration Ceremony
Goal: Provision a synced Primary Credential (PC) + optional Recovery Credential (RC).
1. RP → Browser: navigator.credentials.create({
publicKey: {
rp: { id: "example.com", name: "MyService" },
user: { id: new Uint8Array(16), name: "user@example.com", displayName: "User" },
challenge: randomBytes(32),
pubKeyCredParams: [{ alg: -7, type: "public-key" }], // ES256
authenticatorSelection: {
residentKey: "required", // Discoverable passkey
userVerification: "required" // Biometrics/PIN
},
attestation: "direct", // Verify hardware
extensions: {
credProps: true, // Get credential properties
credProtect: 1 // Enforce PIN (phishing resist)
}
}
})
2. User selects platform authenticator → PC created & synced (e.g., to iCloud).
3. RP stores: userId, PC publicKey, credId (from response).
4. OPTIONAL Recovery: Prompt for RC on separate authenticator.
Repeat create() with:
- `residentKey: "preferred"` (discoverable but portable).
- `requireResidentKey: false`.
- Extensions: `minPinLength: true` (forces strong PIN).
RP stores RC publicKey separately, flagged as "recovery".
Outcome: PC syncs cross-device; RC is user-managed (e.g., backup YubiKey).
Authentication Ceremony (Primary Flow)
Prioritizes local/synced PC, falls back to cross-device.
1. RP → Browser: navigator.credentials.get({
publicKey: {
rpId: "example.com",
challenge: randomBytes(32),
allowCredentials: [PC.credId], // Hint to synced PC
userVerification: "required",
extensions: { appid: false, credProps: true } // No legacy fallbacks
},
mediation: "conditional" // Autofill/passkey mediation
})
2a. Local PC available? → User verifies (biometrics/PIN) → Sign assertion → RP verifies sig.
2b. Synced but remote (cross-device)?
- Browser shows CA QR/BLE UI.
- User scans on Phone (synced PC device):
Phone: get() → Signs remotely → Delivers to Laptop via CDA.
- RP verifies: Checks `crossOrigin` extension if used.
3. Success: Session issued. Fail → Recovery prompt.
Cross-Device Bridge: Relies on platform CDA (e.g., Apple's Nearby Interaction). RP detects via assertion's transports: ["hybrid"].
Phishing-Resistant Recovery Ceremony
Activated on auth failure (e.g., "Lost all devices?"). Uses RC + ephemeral challenge to prevent phishing (no static codes).
1. RP → Browser: "Enter Recovery Mode" → User plugs in/uses RC authenticator.
2. RP → Browser: navigator.credentials.get({
publicKey: {
rpId: "example.com",
challenge: randomBytes(32) + timestamp(24h TTL), // Ephemeral
allowCredentials: [RC.credId],
userVerification: "required",
extensions: {
credProtect: 2, // PIN + gesture required
hmacSecret: true // Optional: Derive session key
}
}
})
3. User verifies on RC (PIN/biometrics/hardware touch).
4. Assertion → RP verifies:
- Sig valid? Cred is RC?
- Challenge fresh? (Anti-replay)
- UserHandle matches account?
5. Success: Temporarily reset PC → Force re-registration of new synced PC.
- Rate-limit: 1 RC use / 24h per account.
- Audit log: Timestamp + authenticator AAGUID.
6. Post-recovery: Prompt new PC registration + new RC.
Phishing Resistance:
- RC bound to RP origin (
rpId).
- No shared secrets; requires possession + verification.
- Ephemeral challenges prevent offline attacks.
- Attestation history blocks cloned keys.
Security Analysis
| Threat | Mitigation |
|---|
| Phishing | rpId/origin binding + UV=required + credProtect. CA uses short-range transport. |
| Device Loss | Synced PC auto-recovers on new device; RC as final backup. |
| Sync Compromise | Platform silos (e.g., iCloud scoped to Apple); RC non-synced. |
| Replay/MITM | Fresh challenges + sig verification. |
| Sync Provider Breach | Public keys only; private keys encrypted per-device. RC offline. |
| Coercion | UV + PIN/gesture; optional duress codes (custom extension). |
Risks & Mitigations:
- Sync opt-in only; educate users.
- RC loss: Social recovery (trusted contacts with threshold sigs, future WebAuthn multisig).
- Compliance: GDPR via minimal data (no privkeys).
Implementation Notes
- Libraries:
@simplewebauthn/browser + @simplewebauthn/server.
- Browser Support: Chrome 109+, Safari 16+, Firefox 122+ for passkeys/CA.
- Testing: Use webauthn.io; simulate cross-device with two browsers.
- Extensions: Monitor W3C for
crossOrigin stabilization.
- UX Polish: Custom UI for CA QR ("Scan with your phone") + progress indicators.
This ceremony is efficient (1-2 WebAuthn ops), standards-compliant, and deductively secure—bridging sync convenience with robust recovery. Questions on specifics?