Passkeys and WebAuthn
Understand the idea
A password can be typed into any site. A passkey will not sign for the wrong origin.
The idea
A password is a shared secret. The user can be persuaded to type it into a page that looks like the bank, and that page receives the same string the bank would have received. A is a WebAuthn credential: a key pair created for one origin. The private key stays in the authenticator. The site stores the public key. When a page asks for a signature, the browser compares the page's origin with the origin stored on the credential. https://phish.example is not https://bank.example, so the browser refuses. There is no signature to steal, even if the page is perfect and the user taps the prompt they would have tapped at the real bank. The run is that origin check. The ceremony around it, the authenticator gesture, is extra. The phishing failure is the origin mismatch.
What changes
| Old approach | Weakness that showed up | What replaced it |
|---|---|---|
| A password, a shared secret the user can type | The real site and a fake site receive the same string if the user types it. The protocol cannot tell the difference, because the secret was never bound to an origin. | A passkey bound to the origin it was created for. The browser will not release a signature to any other origin, so the phishing site cannot obtain a credential that verifies. |
The command
The password travels, the passkey does not
3s timeout · one stateless run. Node and Express use Piston when that instance accepts the job (public EMKC execute is whitelist-only; set PISTON_URL or PISTON_TOKEN). Otherwise a local Node process. MongoDB uses a fresh in-memory server per run, then it is stopped.
The mistake
Check the result
The phish site prints that it accepted hunter2. The passkey line for that host is browser refused. The bank origin is signed for https://bank.example.
Guided challenge
Refuse the wrong origin
passkey currently signs for any origin that is non-empty, including the phishing host. Compare the origin with the origin stored on the credential.
Refuse the wrong origin
3s timeout · one stateless run. Node and Express use Piston when that instance accepts the job (public EMKC execute is whitelist-only; set PISTON_URL or PISTON_TOKEN). Otherwise a local Node process. MongoDB uses a fresh in-memory server per run, then it is stopped.
EXPECTED RESULT
https://phish.example accepted hunter2 browser refused signed for https://bank.example
Hints 0/2
Use all hints or make 3 failed checks (0/3).
Free exploration
Change this example and run it again. Each run is a new process. Nothing is saved.
Your variation
3s timeout · one stateless run. Node and Express use Piston when that instance accepts the job (public EMKC execute is whitelist-only; set PISTON_URL or PISTON_TOKEN). Otherwise a local Node process. MongoDB uses a fresh in-memory server per run, then it is stopped.
Quiz
A quick check for understanding. Retry as often as you like; your learning path stays open.
Ready to call this one understood?
Mark this lesson complete to earn 150 XP. You can always revisit it.