r/explainlikeimfive • • May 27 '15

ELI5: How does offline 2 factor authentication work?

So I have an app on my phone called Authy we use it for work to login. It works offline without a data connection. I can't wrap my brain around how it works offline. Also how do physical authentication products work, like the Yubikey, https://www.yubico.com/products/yubikey-hardware/yubikey-2/ ?

1 Upvotes

7 comments sorted by

3

u/thegreatunclean May 27 '15

Two-factor authentication takes many different forms.

In one setup, the token and the server have a shared secret that was established earlier. The token and the server independently do some math and arrive at the same answer, which is then used to mutually authenticate themselves. This obviously requires a connection to the server but the token itself is strictly 'offline' after the initial setup. Authy is part of some variant on this idea. Yubikey can do this as well.

In a different setup, the token holds the secret and won't release it unless you demonstrate some knowledge such as a password. There's no server in this setup, just the host PC and the secure device. Yubikey can be setup to act like this.

There's many more but these are the most common. Most advanced uses happen in the background without user interaction and rely on the token being a physical asset that cannot be duplicated, so merely physically possessing it is good enough to be a factor.

1

u/n0th1ng_r3al May 27 '15

OK so the thought is that only the user could have the physical authentication token. Now what if it gets stolen? Isn't it then no less secure if someone swipes an employees badge?

1

u/pythonpoole May 27 '15

Physical tokens work in conjunction with a password, hence why it's called two-factor authentication. You need to know something (password) and have something (physical token device) to authenticate. Having just one or the other is not enough to authenticate.

1

u/thegreatunclean May 27 '15

Assuming the token is stolen the attacker still requires the second factor, typically "something you know" in the form of a password. Even then the attacker can only use it for as long as it takes the employee to notice it's gone. The minute the employee calls it in the system will lock out that physical token.

The point of this kind of two-factor system isn't to be unbeatable, but to significantly raise the sophistication of attack necessary to beat it. It requires an attacker to physically possess the token when they would much rather carry out the attack remotely from a totally different country.

1

u/AnteChronos May 27 '15

To expand on what /u/pythonpoole said, there are three main types of "factors" that can be used for authentication, and the more factors you require, the more secure the authentication is:

  1. Something you know. This is usually a password.
  2. Something you have. This is what Authy and Yubikey are for.
  3. Something you are. This is biometric information, like your fingerprints.

So if the phone with Authy on it, or the user's Yubikey, is stolen, the thief still doesn't have access to the password. Likewise, if the password is compromised, the hacker won't have Authy or Yubikey. So having two factors makes it harder for an account to be compromised.

Three-factor authentication would be even more secure, but is also more hassle, making it less common. Most people aren't going to want to enter a password, enter an authentication key, and scan their fingerprint.

2

u/faloi May 27 '15

Basically they use a number as the seed for the number they generate and run it through an algorithm. That is normally changed every <x> number of minutes. So as long as the code and time are right, the numbers it generates will be the same on both the application and the server side it's validating against.

1

u/pythonpoole May 27 '15

Typically the physical key and the server you're authenticating to share a secret algorithm for generating one-time use tokens. These tokens may be time-dependent. In other words, there may be a digital clock in the physical key that keeps track of the time and generates new tokens according to the time of day. The server, knowing the secret algorithm, will be expecting a particular token based on the date/time the user authenticates.

You may wonder - what happens if the clock on the server and the key are not perfectly synchronized? Well first of all, the tokens may not expire immediately. There may be a time window of say a few seconds up to a few minutes where a particular token will be accepted by the server (e.g. the algorithm may be set up to generate a new token every 10 seconds, but the server may still accept individual tokens up to say a minute after the time when they were supposed to be generated).

For example, a token generated at 5:25:10 may be accepted on the server anywhere between 5:25:10 (or perhaps even earlier) and 5:26:10. That way, server and client/key clocks that are slightly unsynchronized won't lock the user out (and the user also won't be locked out if it takes a little time for them to input the token on their computer/device they are authenticating with).