I am already using 31 services with 2nd factor authentication and the number is growing. In addition to having multiple authentication devices, I decided for or had to generate a separate set of one-time backup codes (let's call them OTBC).

I use password manager with 2FA to store all my passwords. I run password manager only on machines I own and manage. However I am mobile so I cannot use a physical vault (for example to store printed OTBC). Password manager introduced its own set of OTBC.

I am considering what is the best practice for securely managing OTBC. I assume I may lose all 2FA devices and this should not prevent me from accessing the services using the OTBC.

It is my understanding that OTBC should be treated with the same level of security precautions as passwords. Otherwise they render 2FA non-existent.

One of 2FA purposes is protection against using passwords obtained by breaching the password manager on non-authenticated devices. So OTBC to respective services cannot be stored alongside their passwords in the password manager otherwise this would render 2FA non-existent.

In result I have the necessity for two separate password managers one for passwords, one for OTBC.

Now, each of password managers introduces its own set of OTBC (to backup the 2FA for the master password) which cannot be memorized.

They should be stored outside of their respective password manager databases. So I can either store them outside of the system or in a cross-fashion:

Passwords-DB <== passwords for services  +  OTBC for OTBC-DB
OTBC-DB <== OTBC for services  +  OTBC for Passwords-DB

Provided the passwords: one for Passwords-DB and one for OTBC-DB are not stored outside of my brain, is it the simplest method for managing OTBC and are there any security flaws or hidden risks in this scheme?

  • 2
    The only risk with storing OTBC in the same password vault is that if your password vault is compromised, the OTBC codes are too. However, your 2FA still has value in that it will protect against shoulder surfing, phishing attacks and password guessing attacks. Oct 27, 2015 at 9:17
  • 1
    And it would still protect against keyloggers on public computers where you don't access your password manager (e.g. if you bring it up on your phone). And MITM attacks. And probably a few other cases like stolen session tokens. I thought a lot about this and I think the only place you become less safe is if a trusted device you access the password manager on becomes compromised.
    – Ben
    Feb 5, 2016 at 17:13
  • 1
    Sorry to dig up a graveyard thread, but I see a problem with your OTP scheme. What if you lose all your devices? You will not be able to get into either password manager to get the other's codes. Aug 29, 2016 at 18:28

3 Answers 3


The problem with storing OTBC on-device is that if your device is compromised software-wise, eg virus infection, trojan, copy attack etc, then you are toast.

Note that once you unlock Password-DB, a malicious entity could access OTBC for the OTBC-DB and then access that too.

My suggestion for securely managing these, is to use 2 separate databases, once for OTBC and one for passwords/2FA. Of course, you do NOT access OTBC-database unless absolute neccessary.

The OTBC for both these password managers, you store in a encrypted text file. In the same text file you store the seed for the OTBC-DB, eg you do NOT have 2FA access to the OTBC-DB unless in a absolute emergency.

To access password-DB/2FA, you need the following:

  • 1: Your Brain Password A.
  • 2: 2FA code or OTBC code taken from encrypted text file.

To access OTBC-DB, you need the following:

  • 1: Your Brain Password B.
  • 2: The contents of the encrypted file (Always!).

The encrypted file is then hosted to your cloud service.

Now to how you should encrypt that text file:

I would suggest using some service, that would upon a secret password trigger, send your encryption key to a email, BUT, only after having waited atleast lets say 24 hours, upon you get a email to "cancel" it.

So when you lose all your 2FA devices, you type your secret "emergency password" into the service. Then you wait 24 hour, then you have your random password to your encrypted file, which are used along with Brain password B to gain access to your OTBC database.

However, if a hacker would try to access the emergency key, you would been given a opportunity to cancel that, and then the hacker could not access that.


I use a YubiKey NEO for all 2-factor methods, including TOTP. The NFC support in it allows me to make use of it with my phone. I wrote up a longer bit on why I bought two of them which is rather relevant to your question.

Here's how this ended up working for me in terms of your question:


One key travels with me all the time on my keychain and one key remains stored at home. I suspect the only likely way for me to lose both of them at once involves a fire where I don't grab my keys upon exit. I don't store any OTBC codes, but if I were to incorporate that, I would do so by printing them out and storing them in a safety deposit box. You mentioned mobility is an issue for you that limits printing things out, but I'd revisit that because it's hard to get a better answer. A trusted person you can contact or an online storage system are your only other options and that storage system is turtles all the way down.

Since it's a dedicated and physically durable device, it has come in handy when I've broken my phone. I can use any computer with a USB port or any phone with NFC support to authenticate with.


The YubiKey doesn't have a "get secret" API, only a read token request based on a timestamp. Thus, unless you currently possess my key or did at one time from which you generated a future token, you can't log in to a service. That limits device compromise risk. It's also not typically in contact with a device which also provide some limitation of time windows for access.

If I can't account for both keys, I know my availability is low and my security considered suspect. At that point I'd go rotate my credentials and enroll a new key.

  • The link is broken
    – Ian Dunn
    Nov 8, 2016 at 16:31

I would store them in an encrypted password vault (Somethg like Dashlane, Lastpass, or 1password.) in the notes section. It will be able to synchronized via mobile and encrypted also. Assuming you aren't using the same password as your master password you would be safe.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .