Passwords·28 questions

How do FIDO2 and WebAuthn hardware security keys work at the browser and server interaction level?

Answer

Hardware security keys, such as YubiKey, are physical devices that connect to a computer or smartphone via USB, NFC, or Bluetooth. They implement cryptographic authentication based on the FIDO2 and WebAuthn standards, completely eliminating the need to transmit passwords over the network. When a user attempts to log into a site, the server generates a unique random sequence of bytes and sends it to the browser along with the requested domain identifier.

The browser passes this request to the connected hardware key. The key checks whether the server domain matches the one saved during registration, making phishing virtually impossible since a fake site cannot impersonate the real one. To confirm the operation, the device requires physical action from the user, such as pressing a touch button or entering a PIN code directly on the token itself.

Upon confirmation, the key uses a built-in secure microchip to create a digital signature using asymmetric cryptography. During initial registration on the site, a unique key pair is generated: the public key is sent and stored on the server, while the private key never leaves the secure memory of the hardware device. During subsequent logins, the key signs the server's random challenge using the private key, and the server verifies the signature using the stored public key.

The server sends a random cryptographic challenge to the browser
The browser forwards the request to the connected hardware token
The user confirms the action by a touch or entering a PIN code
The key signs the challenge with the private key and sends the result back
The server verifies the signature with the public key and authorizes the session

This method provides the maximum level of protection against credential interception, server-side database leaks, and Man-in-the-Middle attacks. Even if the server database is completely compromised by attackers, they will only be left with public keys, which cannot be used to log into the system or recover the original private key.

Was this answer helpful?

More questions in this topic

Related questions from other topics