One-time password


A one-time password, also known as a one-time PIN, one-time passcode, one-time authorization code or dynamic password, is a password that is valid for only one login session or transaction, on a computer system or other digital device. OTPs avoid several shortcomings that are associated with traditional password-based authentication; a number of implementations also incorporate two-factor authentication by ensuring that the one-time password requires access to something a person has as well as something a person knows.
OTP generation algorithms typically make use of pseudorandomness or randomness to generate a shared key or seed, and cryptographic hash functions, which can be used to derive a value but are hard to reverse and therefore difficult for an attacker to obtain the data that was used for the hash. This is necessary because otherwise, it would be easy to predict future OTPs by observing previous ones.
OTPs have been discussed as a possible replacement for, as well as an enhancer to, traditional passwords. On the downside, OTPs can be intercepted or rerouted, and hard tokens can get lost, damaged, or stolen. Many systems that use OTPs do not securely implement them, and attackers can still learn the password through phishing attacks to impersonate the authorized user.

Characteristics

The most important advantage addressed by OTPs is that, in contrast to static passwords, they are not vulnerable to replay attacks. This means that a potential intruder who manages to record an OTP that was already used to log into a service or to conduct a transaction will not be able to use it, since it will no longer be valid. A second major advantage is that a user who uses the same password for multiple systems, is not made vulnerable on all of them, if the password for one of these is gained by an attacker. A number of OTP systems also aim to ensure that a session cannot easily be intercepted or impersonated without knowledge of unpredictable data created during the previous session, thus reducing the attack surface further.
There are also different ways to make the user aware of the next OTP to use. Some systems use special electronic security tokens that the user carries and that generate OTPs and show them using a small display. Other systems consist of software that runs on the user's mobile phone. Yet other systems generate OTPs on the server-side and send them to the user using an out-of-band channel such as SMS messaging. Finally, in some systems, OTPs are printed on paper that the user is required to carry.
A one-time password is the only communication required in some cryptographic schemes for a user to safely send a static encryption key to a server. This lowers the possibility of interception by enabling the server to determine or unlock the static key without the user having to send it directly. An illustration of this method is the Encrypted One-Time Pad system, which shows how a one-time password can enable safe key transfer across an unprotected channel.

Generation

Concrete OTP algorithms vary greatly in their details. Various approaches for the generation of OTPs include:
  • Based on time-synchronization between the authentication server and the client providing the password
  • Using a mathematical algorithm to generate a new password based on the previous password.
  • Using a mathematical algorithm where the new password is based on a challenge and/or a counter.

    Time-synchronized

A time-synchronized OTP is usually related to a piece of hardware called a security token. It might look like a small calculator or a keychain charm, with an LCD that shows a number that changes occasionally. Inside the token is an accurate clock that has been synchronized with the clock on the authentication server. In these OTP systems, time is an important part of the password algorithm, since the generation of new passwords is based on the current time rather than, or in addition to, the previous password or a secret key. This token may be a proprietary device, or a mobile phone or similar mobile device which runs software that is proprietary, freeware, or open-source. An example of a time-synchronized OTP standard is time-based one-time password. Some applications can be used to keep time-synchronized OTP, like Google Authenticator or a password manager.

Hash chains

Each new OTP may be created from the past OTPs used. An example of this type of algorithm, credited to Leslie Lamport, uses a one-way function. This one-time password system works as follows:
  1. A seed is chosen.
  2. A hash function is applied repeatedly to the seed, giving a value of:. This value, which we will call is stored on the target system.
  3. The user's first login uses a password derived by applying 999 times to the seed, that is,. The target system can authenticate that this is the correct password, because is, which is the value stored. The value stored is then replaced by and the user is allowed to log in.
  4. The next login, must be accompanied by. Again, this can be validated because hashing it gives which is, the value stored after the previous login. Again, the new value replaces and the user is authenticated.
  5. This can be repeated another 997 times, each time the password will be applied one fewer time, and is validated by checking that when hashed, it gives the value stored during the previous login. Hash functions are designed to be extremely hard to reverse, therefore an attacker would need to know the initial seed to calculate the possible passwords, while the computer system can confirm the password on any given occasion is valid by checking that, when hashed, it gives the value previously used for login. If an indefinite series of passwords is wanted, a new seed value can be chosen after the set for is exhausted.
  6. Although the server's counter value is only incremented after a successful OTP authentication, the counter on the token is incremented every time a new password is requested by the user. Because of this, the counter values on the server and on the token might be out of synchronization. It is recommended to set a look-ahead parameter on the server, which defines the size of the look-ahead window. In case of an accidental password generation by the user, the server will still authenticate the client, because it can recalculate the next OTP-server values, and check them against the received password from the client.
To get the next password in the series from the previous passwords, one needs to find a way of calculating the inverse function. Since was chosen to be one-way, this is extremely difficult to do. If is a cryptographic hash function, which is generally the case, it is assumed to be a computationally intractable task. An intruder who happens to see a one-time password may have access for one time period or login, but it becomes useless once that period expires. The S/KEY one-time password system and its derivative OTP are based on Lamport's scheme.

Challenge–response

The use of challenge–response one-time passwords requires a user to provide a response to a challenge. For example, this can be done by inputting the value that the token has generated into the token itself. To avoid duplicates, an additional counter is usually involved, so if one happens to get the same challenge twice, this still results in different one-time passwords. However, the computation does not usually involve the previous one-time password; that is, usually, this or another algorithm is used, rather than using both algorithms.

Implementations

SMS

A common technology used for the delivery of OTPs is text messaging. Because text messaging is a ubiquitous communication channel, being directly available in nearly all mobile handsets and, through text-to-speech conversion, to any mobile or landline telephone, text messaging has a great potential to reach all consumers with a low total cost to implement. OTP over text messaging may be encrypted using an A5/x standard, which several hacking groups report can be successfully decrypted within minutes or seconds. Additionally, security flaws in the SS7 routing protocol can and have been used to redirect the associated text messages to attackers; in 2017, several O2 customers in Germany were breached in this manner in order to gain access to their mobile banking accounts. In July 2016, the U.S. NIST issued a draft of a special publication with guidance on authentication practices, which discourages the use of SMS as a method of implementing out-of-band two-factor authentication, due to the ability for SMS to be intercepted at scale. Text messages are also vulnerable to SIM swap scams—in which an attacker fraudulently transfers a victim's phone number to their own SIM card, which can then be used to gain access to messages being sent to it.

Hardware tokens

's SecurID is one example of a time-synchronization type of token, along with HID Global's solutions. Like all tokens, these may be lost, damaged, or stolen; additionally, there is an inconvenience as batteries die, especially for tokens without a recharging facility or with a non-replaceable battery. A variant of the proprietary token was proposed by RSA in 2006 and was described as "ubiquitous authentication", in which RSA would partner with manufacturers to add physical SecurID chips to devices such as mobile phones.
Recently, it has become possible to take the electronic components associated with regular keyfob OTP tokens and embed them in a credit card form factor. However, the thinness of the cards, at 0.79mm to 0.84mm thick, prevents standard components or batteries from being used. Special polymer-based batteries must be used which have a much lower battery life than coin cells. Semiconductor components must not only be very flat but must minimise the power used in standby and when operating.
Yubico offers a small USB token with an embedded chip that creates an OTP when a key is pressed and simulates a keyboard to facilitate easily entering a long password. Since it is a USB device it avoids the inconvenience of battery replacement.
A new version of this technology has been developed that embeds a keypad into a payment card of standard size and thickness. The card has an embedded keypad, display, microprocessor and proximity chip.