PassKeys is relatively new way of authentication. This presentation aims to provide a bit of guidance on how you can implement them in your own application.
Size: 648.89 KB
Language: en
Added: May 11, 2024
Slides: 33 pages
Slide Content
PassKeys
How to implement them
Presenter:
Marian Marinov
Organization:
Director of Engineering
Web Hosting Canada
What are passkeys?
The idea behind them is to replace username
and password combinations with something
more secure and generally unique per
application/website.
Are passkeys more secure?
➢ Randomly generated long string
➢ Cryptographically signed
➢ Cryptographically verifiable
➢ Unique passkey pair for each site/application
➢ Eliminating the possibility to reuse either usernames
or passwords
Reality
➢ Usernames are still required
➢ Computer generated strings are hard
➢ Usage is cumbersome
➢ Adoption is low
➢ Reports for problems with major vendors
Reality
➢ Usernames are still required
➢ Computer generated strings are hard
➢ Usage is cumbersome
➢ Adoption is low
➢ Reports for problems with major vendors
➢ Why I decided to speak about this topic?
Reality
➢ Usernames are still required
➢ Computer generated strings are hard
➢ Usage is cumbersome
➢ Adoption is low
➢ Reports for problems with major vendors
➢ Why I decided to speak about this topic?
➢
https://www.peeringdb.com/
Implementation
Handling of PassKeys on the client side
Implementation
Handling of PassKeys on the client side
➢ You can use HW device (i have examples)
Implementation
Handling of PassKeys on the client side
➢ You can use HW device (i have examples)
➢ You can also use iPhone or Android
Implementation
iPhone/Android situation
➢ Your authentication keys are stored on their cloud
➢ You have limited control
➢ The vendor can delete those without your concent
➢ The vendor can limit your access to your creds at any
given time
PassKeys process
PassKeys process
Credit Yubico
PassKeys process
Credit Yubico
On the backend
Registrations
➢ Generate random challenge with expiration time
(CSRF)
➢ Generate new user_id based on the username +
challenge
➢ Enrol passkey (pubkey + user_id)
➢ Store the generated pair on the backend
On the frontend
➢ Most of the work is here
➢ Support for devices in Browsers
➢
All major browsers support it
➢ Annoying and large frontend libraries
Fronted implementation
➢ I decided to ride the wave of AI
➢ I asked ChatGPT to assist me
Fronted implementation
➢ I decided to ride the wave of AI
➢ I asked ChatGPT to assist me
➢ Big mistake!
Fronted implementation
Once it was clear it will not build it for me...
Fronted implementation
I shamelessly stole the web interface from
https://webauthn.io
Backend implementation
I used PostgreSQL
I needed two tables:
➢ challenges
➢ credentials
Challenges would probably be better with
Redis/DragonFly auto expiring keys
Backend implementation
I used PostgreSQL
table: challenges
id
username
challenge
created
Backend implementation
I used PostgreSQL
sign_count, if implemented allows prevention of
replay attacks
table: challenges
id
username
challenge
created
table: credentials
id
sign_count
user_handle
credential_id
public_key
Backend implementation
I tried initially writing it in PHP with
web-auth/webauthn-lib
It did not work. Their example returned:
PHP Fatal error:
Uncaught Error: Class "Webauthn\Server" not found
Backend implementation
Then I switched to my favourite
I found Authen::WebAuthn ...
But I decided to try to build it from scratch.
My basic Mojolicious app
I ended up creating the following
endpoints in my app:
get '/' Login form
post '/auth-options' Challenge generation
post '/auth-verify' Authentication
validation
post '/register' User ID generation
post '/reg-verify' Registering the user
Important definitions
➢ rp_id - Relying Party (hostname of your app)
➢ credential_id - ID that is stored on the backend
➢ allowCredentials - the server may request specific
credentials
Backend- Registration
1. /auth-options - get supported options from the
backend
2. /register - register the client and return passkey
data
3. /reg-verify - validate the credentials
Problems with passkeys?
➢ Multiple reports that Apple has completely erased
the passkey store for users
➢ Not fully supported everywhere.
➢ Cumbersome with HW devices
➢ Device missing
➢ Requiring restart of browsers in order to recognize
a device