Yubikeys are pretty neat! They provide a simple, open and convenient package for generating one time passwords. The price is also at a point where it becomes cheap enough to add a reasonably good layer of additional security for two factor authentication.
The basic idea is to plug in the USB key and press its button. The key registers itself as a USB keyboard, so no special software is required, and the one time passwords are generated in about a second. The key and the authentication server share an AES key and the one time passwords are validated by keeping track of how many times the key has been used.
Quite a lot has already been written about Yubikeys but it did take a bit of searching to find the finer details. The following two links were the most helpful for understanding the implementation and being able to write my own.
See what’s inside a Yubikey generated password after the jump…
A Yubikey OTP looks like a random string. It is actually made up of the ID of the individual key concatenated with the unique token.
The Yubikey ID is the same every time and is used by the authenticating server to look up the AES shared key which it can then use to decode the token.
The actual process for decoding the token is described in the first link above. Here we will just look at what the decrypted token contains and how each password can be checked. The resulting data contains information about the state of the Yubikey:
The sercret Id would be checked with the value in the authenticating database and will be the same each time.
The various counters can be used to prevent replay attacks and the timer can be used to roughly verify that the generation times are similar to the request times. I’m not totally convinced by the accuracy or security provided by the timers but this is the sacrifice that must be made to make the Yubikey universally compatible and simple (ie. no special software and no batteries).
The plugin counter has a limitation of 2^16 inserts before the counter rolls over. The combination of the timer and key presses also limits the length of a single plug-in to ~24 days or 255 OTPs depending on the server implementation. This is probably ‘good enough’ for most applications and keys can be refreshed with new AES keys and IDs so the hardware doesn’t become useless.
The list of fields that would need to be stored on the authenticating server are as follows:
These also make up the variables that are stored in non-volatile and volatile memory inside the Yubikey (but can’t be read from the key).
In summary, the Yubikey is useful for a lot of applications but there are a few limitations that may be show-stoppers for people. I can see the product evolving further or the introduction of new products to suit different requirements. The open nature of the software makes integration cheap and incredibly simple and if Yubico stick to this principle, their products are certainly worth looking out for.