Sub topic 12
Backups and recovery without opening a back door
This chapter assumes you know what TOTP codes and passkeys are, and that you have enrolled at least one of them on an exchange account. It covers how to plan for losing a device without creating a weaker path that an attacker can use instead.
Why recovery is part of the security design
Every strong factor has a failure mode: the phone is lost, stolen, wiped or broken. The exchange then needs some way to let the real owner back in. That recovery path is itself a way in. An attacker who cannot beat your passkey will try the recovery path.
So the account is only as strong as its weakest working route. If you protect login with a hardware key but recovery needs only an email link and an SMS code, an attacker will use recovery.
Two goals pull against each other:
- Availability: you can get back in after losing a device.
- Security: nobody else can get in by pretending to be you.
Good planning gives you several independent ways to recover that are hard for others to reach, and it avoids a single point of failure in either direction.
What can be lost
Different factors fail in different ways, so plan for each.
| Factor | Typical loss event | What you need to recover |
|---|---|---|
| TOTP app | Phone lost, reset or replaced | The original secret, a backup of the app's data, or a recovery code |
| Synced passkey | Device lost | Access to the sync provider account on a new device |
| Device-bound passkey | Device lost or broken | A second registered passkey, or a recovery code |
| Hardware security key | Key lost or damaged | A second key, or a recovery code |
| Email account | Locked out or hijacked | The email provider's own recovery process |
The email row matters because many exchanges use email for password resets and for confirming recovery. An email account with weak protection undermines everything built on top of it.
Recovery codes
Most exchanges offer one-time backup codes when you enable two-factor authentication. Each code works once and bypasses the second factor. Some exchanges instead show the TOTP secret itself as a backup key.
Handle them as follows:
- Generate them when you enroll, not later.
- Store them offline, for example printed and kept in a safe, or in a password manager that is itself protected by a strong factor.
- Do not store them in the same place as the factor they replace. A code kept in a note on the phone you may lose is no backup.
- Do not keep them in a screenshot, in email, or in a plain cloud notes app.
- After using one, check how many remain. Regenerate the set if few are left. Regenerating normally invalidates the old set, so replace your stored copy.
Treat these codes like the factor itself. Anyone holding one can skip your passkey or authenticator code.
Backing up the TOTP secret
An authenticator app holds a shared secret. If the phone is lost, the secret is lost, and the exchange cannot recompute your codes. You have three options.
- Save the secret at enrollment. The QR code carries an
otpauth://URI containing the base32 secret. The exchange usually also shows it as text. You can write that text down and store it offline. Anyone who sees it can generate your codes, so never photograph it into a synced gallery. - Use an app with encrypted backup or multi-device sync. This is convenient. The trade-off is that your codes now depend on that provider's account security, so protect that account with a passkey or hardware key.
- Enroll the same secret on two devices at setup. Scan the QR code on both devices during enrollment. After you leave the page, the exchange usually will not show the secret again.
A related point: a code is only valid for its 30-second window, but the secret never expires. Treat a leaked secret as a full compromise of that factor. Reset it on the exchange rather than hoping nobody used it.
Planning passkey redundancy
The safest approach is to register more than one passkey, on different kinds of authenticators.
- Synced passkey in a platform password manager or your phone's account. It follows you to new devices through the provider's sync, which is convenient. Your recovery then depends on that provider's account security.
- Two hardware security keys, one kept with you and one stored elsewhere, such as a safe or a trusted location. They are the strongest option and do not depend on a cloud account.
- Device-bound passkey on a laptop or phone, as a third option.
The exchange must allow several credentials per account. Check this in its security settings before you rely on a single key. Also give each one a clear name, such as "Blue key, home safe", so you can remove the right one later.
Recovery without a back door
A recovery path becomes a back door when it relies on something an attacker can obtain more easily than your main factor. Common weak points:
- SMS recovery. SIM swapping lets an attacker receive your texts. If SMS can reset a passkey or TOTP, the strong factor is only decoration.
- Email-only reset. If the email account has a weak password or no strong second factor, the attacker takes it over and then resets the exchange account.
- Support resets. A support agent can be tricked with stolen documents or a convincing story. Exchanges often add a waiting period and a face-match check. Learn what yours requires.
- Security questions. Answers are often public or guessable. Do not use them where you have a choice, and if you must, use random answers stored in a password manager.
A useful check is to ask, for each recovery route, what an attacker would need to control. If the answer is just your phone number or your inbox, the route is weak.
Settings to look for
Many exchanges offer controls that harden recovery. Names vary, so check your own exchange.
- Remove SMS as a login or recovery method once stronger ones are enrolled.
- Enable a withdrawal lock after any change to security factors. A common delay is 24 to 72 hours, during which withdrawals are blocked. This gives you time to notice an attacker's change and react.
- Turn on notifications for factor changes, new logins and recovery attempts, and send them to an email address that is protected separately.
- Keep a dedicated email address for the exchange, with its own strong factors, that you do not use elsewhere.
Test your recovery before you need it
A backup you have never tried is a guess. Do these checks when you are calm:
- Sign out on a spare device or browser profile and sign in using each registered passkey in turn.
- Confirm that the offline TOTP secret produces the same code as your app. The following script computes the current code from a secret so you can compare it against the app.
import base64
import hashlib
import hmac
import struct
import time
def totp(secret_b32, step=30, digits=6, at=None):
key = base64.b32decode(secret_b32.upper() + "=" * (-len(secret_b32) % 8))
now = time.time() if at is None else at
counter = int(now // step)
mac = hmac.new(key, struct.pack(">Q", counter), hashlib.sha1).digest()
offset = mac[-1] & 0x0F
value = struct.unpack(">I", mac[offset:offset + 4])[0] & 0x7FFFFFFF
return str(value % 10 ** digits).zfill(digits)
if __name__ == "__main__":
# Replace with your own backup secret only on a trusted, offline machine.
print(totp("GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ"))Run it only on a machine you trust, and never paste a real secret into an online tool. The secret in the script is the public RFC test value, not a real one.
- Read the exchange's recovery documentation and note how long a reset takes and what identity proof it needs.
- Confirm that you can still reach your recovery email and that its own recovery options are current.
Repeat after any change, such as a new phone or a switch of password manager.
Common errors
- Enrolling a single factor. One lost key then means a slow, high-friction support process.
- Keeping all backups in one place. A fire, theft or one cloud breach removes everything.
- Storing recovery codes next to the factor. For example, a codes file inside the same phone backup.
- Forgetting to update after rotating. After you remove a lost key or reset TOTP, generate new recovery codes and delete the old copies.
- Leaving old credentials registered. A lost key that stays registered is still a valid way in for whoever finds it. Remove it from the exchange as soon as you know it is gone.
- Relying on a shared device. Do not register a passkey on a work or family computer you do not control.
Summary of a sound setup
A reasonable baseline for an exchange account is:
- Two passkeys of different types, or two hardware keys stored apart.
- One TOTP method as a fallback if the exchange does not accept passkeys everywhere, with its secret stored offline.
- A set of recovery codes stored offline and not with the devices.
- SMS removed from login and recovery where possible.
- A withdrawal delay after security changes, and alerts to a protected email address.
- A tested recovery drill, repeated after every major change.
Exercise
You have a passkey on your phone and a TOTP app on the same phone. The exchange offers SMS as a recovery method. Name two weaknesses in this setup and one fix for each.
Show answer
First, both factors live on one device, so losing the phone removes both. Fix: register a second passkey on a hardware key kept elsewhere, and store the TOTP secret or recovery codes offline. Second, SMS recovery can be defeated by SIM swapping, so an attacker could bypass the passkey. Fix: remove SMS as a recovery method once the stronger ones are enrolled, and rely on recovery codes and the second key instead.
Exercise
Why should you remove a lost hardware key from the exchange account even though the key needs your PIN or fingerprint to work?
Show answer
A found or stolen key could be attacked, and the PIN may be guessable or observed. A registered credential remains a valid way into the account until it is removed, so deleting it closes that path and costs you nothing once you have another factor.