Skip to content
Trapdoor·Lab

Passkeys (WebAuthn)

1Toy

An account without a password, step by step

A passkey is a signing key pair that your device creates separately for every domain. At registration the server gets only the public key. At sign-in it sends a one-time challenge — unpredictable thanks to randomness — and the device, once you confirm with a fingerprint, your face or a PIN, signs it with the private key. The browser acts as the go-between through the WebAuthn API (WebAuthn Level 3, a W3C Recommendation of 25 August 2026) and adds the page address to the signed data itself.

Below is this site’s real account form, not a mock: it creates an account, signs in and signs out, and pauses after every step on the way. The server asks for no e-mail and no password — it names the account itself. The account is optional: everything works without it, and your progress stays in this browser. If you would rather not create one, walk the same steps on the example from the specification.

A passkey account, step by step

This is a real account on this site, and the form shows what it does: during registration and sign-in it stops after every step of the conversation between the browser, the server and your device.

Over the network (under TLS)

  • the challenge and options from the server
  • at registration: the public key and the passkey ID
  • at sign-in: the signature and the signed data
  • then, if the passkey has PRF: the wrapped data key and the encrypted progress

Never reaches the server

  • the passkey’s private key
  • fingerprint, face, PIN — the server gets only the UV flag
  • the PRF output — the browser derives the key to your progress from it

Create an account with no password and no email — and see, one step at a time, what the browser, the server and your device say to each other.

Creating an account uses Cloudflare Turnstile, which sees your IP address and browser headers. Its script from challenges.cloudflare.com runs on this page on every visit, signing in included, though only registration checks its token.

  1. 1

    Challenge from the server

  2. 2

    Your device creates keys

  3. 3

    Public key to the server

  4. 4

    The server’s verdict

Note step 2. The page address (origin) is written into clientDataJSON by the browser, and the domain hash (rpIdHash) is computed by the device — the page’s script has no say in either. A registration with attestation “none” is signed by nobody (§8.7); the first signature is made at sign-in and covers the device’s data together with a hash of clientDataJSON (§6.3.3). The BE and BS flags tell whether the passkey lives in a single device or is synced by a password manager (§6.1.3). The signCount counter helps detect a cloned key (§6.1.1); passkeys in iCloud Keychain always report 0 (Apple), because several devices use the same copy. A challenge should be at least 16 bytes long (§13.4.3); this server draws 32. Registration and sign-in also ask for the PRF extension: from its output the browser derives the key that encrypts your progress on the account, and the server gets only ciphertext — the Your account station shows the details.

2Break it

A fake site and a quantum computer

One of the most common ways to take over an account is still a fake site: it looks like the real one, has an address that differs by one character and asks for the password, and more and more often also for a code from a text message or an app, which a relay server passes straight on to the real site. A passkey does not depend on your vigilance — whether the site is real is decided by the browser. The toy below makes this page really ask for a passkey of a foreign domain.

A fake site asks for a passkey

You are on the attacker’s side. You have a fake of this site at trapdoor1ab.example — the request for another domain’s passkey really goes to your browser; the rest is a simulation.
This page
fake
trapdoor1ab.example

Your fake sits at trapdoor1ab.example and looks like this site. Check whether it can phish a passkey for trapdoorlab.app.

The refusal comes from the browser before the device says a word: a page may only ask for passkeys of its own domain or of a domain that lets it in through the /.well-known/webauthn file (§5.11). That file sits on the owner’s server, so a fake cannot add itself to it — which is why the toy asks for a .example domain, reserved in RFC 2606, under which nobody will publish such a file. The second layer is the server: every answer signed on the fake would contain the fake’s address and the hash of its domain, and the server compares both with its own (§13.4.9, §7.2). That is why phishing is “resistant” in the graph. The word has limits: a passkey will not protect an account from malware on the device, nor from theft of the session cookie after sign-in — a stolen cookie works without the passkey. Here it is HttpOnly, Secure, SameSite=Strict and carries the __Host- prefix.

Shor’s algorithm is a threat of a different kind. Passkeys today usually sign with ES256 — ECDSA on an elliptic curve — or with RSA, and the public keys sit on the server from the day of registration; a large enough quantum computer will recover the private keys from them and sign any sign-in. Unlike encryption, which the post-quantum hybrid protects, recording today’s sign-ins gets an attacker nothing: a signature has to be made over a fresh challenge, so it is enough to replace passkeys before such a computer exists. RFC 9964 (May 2026) gave ML-DSA signatures the COSE identifiers −48, −49 and −50, and WebAuthn will accept any algorithm the server lists in pubKeyCredParams; what is missing are devices that support it, and ASP.NET Core Identity in .NET 11 offers nine classical algorithms. ML-DSA-44 has a 1312 B public key and a 2420 B signature, against 64 B and about 72 B in ES256 (see the ML-DSA station).

3In the real world

Passkeys in the world

  • Cloudflare (2022)In July 2022 at least 76 Cloudflare employees received text messages with a link to cloudflare-okta.com, a domain registered less than 40 minutes earlier, and three of them entered their credentials there. Signing in required FIDO2 keys bound to the origin, so relaying the credentials live got the attackers nothing.Source (Cloudflare (2022))
  • Microsoft — AiTM (2022)Since September 2021 a campaign with a relay server attempted to target more than 10,000 organisations. The whole sign-in went through the relay, which captured the password and the session cookie, so the attacker got into the account even with MFA enabled. As protection Microsoft points to phishing-resistant MFA, FIDO2 included.Source (Microsoft — AiTM (2022))
  • Google (2023)On 10 October 2023 passkeys became the default way to sign in to personal Google accounts — the option to skip the password when possible is on from the start. Google says signing in with a passkey is 40% faster than with a password.Source (Google (2023))
  • Microsoft (2025)On 1 May 2025 Microsoft announced that new Microsoft accounts are passwordless by default. Passkey users get into their account about 98% of the time, password users 32%; a passkey sign-in is 8 times faster than a password with a second factor, and nearly a million passkeys are added every day.Source (Microsoft (2025))
  • iCloud KeychainApple syncs passkeys between a user’s devices through iCloud Keychain, end-to-end encrypted with keys not known to Apple, and the service gets only the public key. Apple calls passkeys highly phishing-resistant.Source (iCloud Keychain)
  • NIST SP 800-63B-4NIST’s 2025 guidelines allow synced passkeys up to AAL2 but not AAL3, because syncing requires exporting the key. The verifier has to check the UV flag, and from the BE and BS flags it can read whether the key may have a copy and whether it already has one.Source (NIST SP 800-63B-4)
4Take it to your project

Passkeys in your service

Good practice

Leave verifying the ceremony to a library that the platform vendor patches — here ASP.NET Core Identity does it. Require UV, draw the challenge on the server and keep it in the ceremony state, compare the origin exactly against a list and reject crossOrigin. In the browser use parseRequestOptionsFromJSON and toJSON(), and send the server only the fields it needs. Return a generic refusal.

JavaScript
const res = await fetch('/api/account/login/options', { method: 'POST' });
const credential = await navigator.credentials.get({
  publicKey: PublicKeyCredential.parseRequestOptionsFromJSON(await res.json()),
});
const { id, rawId, type, authenticatorAttachment, response } = credential.toJSON();
await fetch('/api/account/login', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  // extension outputs (e.g. PRF) stay in the browser
  body: JSON.stringify({ id, rawId, type, authenticatorAttachment, response, clientExtensionResults: {} }),
});
C#
builder.Services.Configure<IdentityPasskeyOptions>(options =>
{
    options.ServerDomain = "example.org";
    options.ResidentKeyRequirement = "required";
    options.UserVerificationRequirement = "required";
    options.AttestationConveyancePreference = "none";
    options.ValidateOrigin = context => ValueTask.FromResult(
        !context.CrossOrigin && context.Origin == "https://example.org");
});

// Identity checks the challenge, origin, rpIdHash, UP/UV, the signature and the counter.
var result = await signInManager.PasskeySignInAsync(credentialJson);
return result.Succeeded ? Results.NoContent() : Results.Problem(statusCode: 401, title: "Sign-in failed");
Anti-pattern

Do not compare the origin by prefix or with Contains, do not draw the challenge in the browser and do not tell the client which condition failed. Do not send the whole toJSON(): with prf.eval it carries the PRF output, which is a secret. Do not write your own WebAuthn verification for production — the decoder in this toy only shows the bytes. And do not treat a passkey as protection for the session: the cookie after sign-in has to be protected separately.

JavaScript
// ✕ a challenge from the browser — the server has nothing to compare it with, so a recording passes
const challenge = crypto.getRandomValues(new Uint8Array(32));

// ✕ toJSON() carries the PRF output — a secret that must stay in the browser
const credential = await navigator.credentials.get({
  publicKey: { ...options, extensions: { prf: { eval: { first: salt } } } },
});
await fetch('/api/account/login', { method: 'POST', body: JSON.stringify(credential.toJSON()) });
C#
// ✕ lets https://example.org.evil.example through
options.ValidateOrigin = context => ValueTask.FromResult(context.Origin.Contains("example.org"));

// ✕ the reason for the refusal tells a forger which check to get around
var attestation = await signInManager.PerformPasskeyAttestationAsync(credentialJson);
if (!attestation.Succeeded) return Results.Problem(statusCode: 400, detail: attestation.Failure.Message);