random technical thoughts from the Nominet technical team

A quick review of Yubikey One-time-passwords

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5 out of 5)
Loading ... Loading ...
Posted by tom on Mar 18th, 2009

yubikeyYubikeys 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.

  1. Yubikey password format and test vectors
  2. Yubikey simulator

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.

Yubikey OTP

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:

decoded token

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.

6 Responses

  1. Olga Says:

    Another good OTP token that could surely be a serious competitor to YubiKey is UmiKey and just like YubiKey it works with my favorite Rohos Logon – http://www.rohos.com/2010/01/umikey-otp-authentication-token/

  2. Werner Says:

    UmiKey is a rip off from the original Yubikey.

  3. Clive Says:

    … and 250% cheaper than the Yubikey so advantage Umikey!

  4. Dick Says:

    Umikey is not as straight forward to develop for. Therefor, fail.

  5. David.S @ Flooring Melbourne Says:

    in terms of security, how is Umikey compare to Yubikey?

  6. Maurice S Says:

    I personally used the Yubikey during a year then I switched to the Swekey that is way more user friendly (no button to click on).

    A very cool feature is also that you are automatically logged out when the swekey is unplugged.

    The Yubikey does not let you login to your site from a smartphone, the Swekey does support it !

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.

Recent Posts

Highest Rated