Skip to content
SecureKeys

Learn

Authenticator codes on a security key (OATH): when it helps and its limits

How a YubiKey can store TOTP and HOTP secrets instead of your phone, how many it holds, how to protect them, and why it is still not phishing-resistant.

SecureKeys Engineering ·

Many services still only offer six-digit authenticator codes. A multi-protocol security key such as the YubiKey 5 can hold the secrets behind those codes, so they live in the key’s secure element instead of on a phone.

How it works

  • TOTP (time-based) codes change every 30 seconds. The key has no clock, so an app reads the code from it: Yubico Authenticator on Windows, macOS, Linux, Android or iOS, over USB or NFC.
  • HOTP (counter-based) codes move on each use. They can drift out of step if codes are generated and not used; most servers accept a small look-ahead window.
  • The secret is generated by the service, scanned or pasted into the app once, and written to the key. It cannot be read back out.

Capacity: YubiKey 5 firmware 5.7 and later stores up to 64 OATH credentials; older firmware stores 32. FIDO2-only keys such as the Security Key Series have no OATH function.

Why bother

  • Codes follow the key, not the phone. A lost, replaced or wiped phone does not take your codes with it, and the same key works with the app on several devices.
  • Secrets cannot be copied by malware on the phone or computer, because they never leave the key.
  • Shared admin accounts for which a service allows only one authenticator can be held on a key kept in a safe, instead of on one person’s phone.

Protect the key

  • Set a password on the OATH function in Yubico Authenticator. Without it, anyone holding the key can read every code. The app can remember it on trusted devices.
  • Require touch for sensitive accounts, so a code is only produced when someone taps the key.
  • Register a second key with the same secrets during setup, or keep the service’s recovery codes. Secrets cannot be backed up from a key afterwards.

The limit: codes can still be phished

Storing the secret in hardware does not change what happens to the code. A fake login page can still ask for it and replay it within 30 seconds. Where a service supports FIDO2 security keys or passkeys, use those instead; they check the website’s address before they sign anything. FIDO2 versus TOTP explains the difference.

Use OATH on a key for the services that offer nothing better, and as a stronger home for codes you already depend on.

References

  1. Yubico developers: OATH
  2. Yubico technical manual: OATH
  3. Yubico technical manual: 5.7 firmware specifics
  4. IETF RFC 6238: TOTP
  5. IETF RFC 4226: HOTP

Plan your move beyond passwords

Talk to our engineers about phishing-resistant authentication for your organisation. We reply within one business day.