2020-08-05
Security Foundations: How to Secure Your Wallet Recovery Phrase for Cryptocurrency Wallets
- Securing a wallet recovery phrase starts with a security mindset that weighs adversaries, from opportunistic thieves to state actors, against the CIA triad of confidentiality, integrity, and availability.
- A disposable Ubuntu sandbox booted from a USB drive with Rufus creates a malware free workspace for handling sensitive keys.
- A YubiKey generated salt password combined with two memorable words and a PIN becomes an unbreakable but easy to recall master password for a LastPass vault and email.
- GPG and Kleopatra build separate hot and cold PGP keys, then double encrypt a Ledger or Trezor recovery phrase so both a hardware key and a shielded software key are needed to ever read it.
- The double encrypted recovery phrase gets backed up on an encrypted flash drive, in LastPass, and in email, safe because encryption rather than secrecy of location protects it.
- Total cost for the full setup is a bit over 200 dollars, and further learning can continue with Ross Anderson's Security Engineering, Katz and Lindell's cryptography text, and a free Coursera cybersecurity course.
12 chapters · 70 markers
Lecture overview: securing your wallet recovery phrase 2
This lecture teaches any cryptocurrency user, whether on Bitcoin, Ethereum, EOS, Tezos, or Cardano, how to secure a wallet recovery phrase and harden their whole digital life from first principles.
The wallet recovery phrase comes from the 2013 BIP 39 standard, a list of 12 to 24 words that restores any HD format wallet, and Ian Coleman built the widely used web tool for generating and checking these words.
Security mindset and the CIA triad 5
Building a security mindset starts with the concept of an adversary, someone operating inside a system with real capabilities aimed at whatever value is at risk.
Every security setup is a balancing act inside the CIA triad of confidentiality, integrity, and availability, since no solution is perfectly secure.
Adversaries span a spectrum from opportunistic novices who steal an unattended phone at a cafeteria, to organized crime running ransom and blackmail operations, to state actors like the NSA, the FSB, and MI6 with multi billion dollar budgets.
An adversary is never static, it keeps adapting and growing, so your own geography, lifestyle, and how much money is at risk determine what level of attacker you are likely to attract.
North Korea is good evidence of a state level actor behind several major Bitcoin heists, showing that adversary sophistication rises with the value at stake.
Infosec mentors: Schneier and Gibson 2
Bruce Schneier is a favorite infosec mentor, with his blog at schneier.com and books like Click Here to Kill Everybody, Data and Goliath, Liars and Outliers, Beyond Fear, and Secrets and Lies.
Steve Gibson's long running Security Now podcast is another go to resource for tracking major hacks and information security news on a weekly cadence.
Building a secure operating environment 8
A secure operating environment has two planks, the system and the person, since novices hack computers but experts hack people, as shown when the 2020 Twitter hack succeeded through social engineering rather than by breaking any code.
A hierarchy of secure computing setups runs from a virtual machine, to dual booting, to a memory only live image, to a hardened Coreboot system, up to the fully air gapped specialty systems used by agencies like the NSA.
Booting a live image runs entirely in RAM and leaves no trace on disk, a step up in security from simply dual booting into a separate hard drive partition.
A 40 dollar Samsung USB 3.1 flash drive booted into a memory only live Linux distribution is the recommended sweet spot for an average user's secure sandbox.
Rufus burns a bootable Ubuntu USB drive, and changing the boot order in the computer's BIOS lets you boot straight into that disposable sandbox.
The live Ubuntu sandbox resets to a clean state on every restart, so nothing generated inside it, including cryptographic keys and the recovery phrase, ever persists once you reboot.
An Apricorn hardware encrypted flash drive with a PIN keypad and FIPS 140-2 compliance, the same standard used for classified military data, carries files out of the sandbox and wipes itself after 10 wrong PIN attempts.
After finishing sensitive work, the plan is to save only the vetted files onto the encrypted drive, exit the sandbox, and carry just those files back into a normal operating system.
The secure skeleton key concept 6
Level three is building a secure skeleton key so the user only has to memorize three things, two proper nouns and one PIN code of at least eight digits.
The mnemonic number shape pegging method, the same technique people use to memorize pi to 30000 digits, makes an eight digit PIN easy to recall.
Reusing one password everywhere was the early internet norm, so a single breached site compromised every account, which is why password managers were invented to generate a unique password per site.
Multi factor authentication, borrowed from the military and intelligence world, rests on three factors, something you know, something you have, and something you are.
Military biometric access has long used CAC common access cards, alongside specialty hardware like an LG phone that scanned the vasculature in a user's hand as a unique fingerprint.
Consumer biometrics like fingerprint readers, Windows Hello, and Apple's face scanner have brought military grade multi factor authentication to ordinary phones and laptops at low cost.
YubiKey and the salted master password 5
The YubiKey is the recommended hardware Swiss Army knife of security, durable, batteryless, and able to generate one time passwords, static passwords, and PGP keys.
YubiKeys come in USB-A, USB-C, and Lightning connector versions, and read a quick tap differently from a long touch on their built in electrostatic pad.
A quick tap on the YubiKey generates a fresh one time password each time, meant for authentication rather than as the salt for a master password.
Configuring the YubiKey's long touch slot to output a fixed salt, then appending a memorable city name, a person's name, and an eight digit PIN, produces a master password that is never fully typed or memorized by its owner.
The resulting salted master password is effectively unbreakable by brute force, yet the human side of it is just three simple things anyone can remember for life.
Setting up LastPass 7
LastPass is the recommended password manager, free or 3 dollars a month for premium, working across Windows, Mac, Linux, Android, and iOS.
The LastPass browser extension and mobile app auto fill saved logins, unlocking with a fingerprint tap so daily use barely changes once the vault is set up.
A LastPass vault can store passwords, notes, addresses, and card details, secured further with app based multi factor authentication like Microsoft or Google Authenticator alongside the YubiKey.
LastPass also offers printable backup codes and device fingerprinting, so a stolen password alone cannot be used to log in from an unrecognized device.
Because most sites tie account recovery to an email address, the email account is the second skeleton key and needs the same hardened password and multi factor authentication as the password manager.
Rotating every account to a long randomly generated password inside the secure sandbox typically takes an hour or two, safe from any key logger or malware while it happens.
Secure storage splits into offline, the Apricorn hardware drive, and high availability online options, the LastPass vault and, surprisingly, plain email, both made safe once encryption is layered on top.
PGP and public key cryptography basics 5
Ubuntu ships with GPG, the open source implementation of the PGP public key cryptography standard that underlies internet security.
Public key cryptography, also called asymmetric cryptography, traces back to Rivest, Shamir, and Adleman's RSA and to Diffie and Hellman's key exchange, and is what puts the padlock icon in every browser.
A PGP key pair works like a lockable envelope, the public half lets anyone lock a message, but only the matching private half, kept shielded behind a password, can ever unlock it.
The PGP standard dates to 1991, with its latest specification from 2007 credited to Jon Callas and Phil Zimmermann, and Hal Finney, the first person to receive a Bitcoin transaction from Satoshi Nakamoto, was also one of its original authors before he died of ALS.
Kleopatra is the PGP management software for Windows and Mac available from gpg4win.org, while Mailvelope is the cross platform browser extension for encrypting and decrypting email and files.
Generating hot and cold PGP keys 10
Two separate PGP key pairs get generated for this setup, a hot key that lives in the browser and a cold key that lives only on the YubiKey hardware.
Generating a PGP key in Kleopatra with RSA 4096 and no expiration date is the recommended setting for a key meant purely for encryption rather than rotating communication.
The 60 character passphrase that shields a new PGP key gets generated with LastPass and saved straight into the vault, so it never has to be memorized.
A test PDF built in LibreOffice and encrypted with the hot PGP key becomes an unreadable dot GPG file that only the matching private key can open.
Public PGP keys can be published to key servers like the MIT key server, so anyone in the world can encrypt a message to you while only you can decrypt it.
Preparing a YubiKey for PGP requires the command line tool gpg card edit to set new PIN, unblock, and reset codes before Kleopatra can generate keys on the hardware itself.
A YubiKey behaves like a smart card, three wrong PIN attempts lock it, and it ships with the well known factory admin PIN 12345678 that should always be changed.
Kleopatra's manage smart cards tool generates the cold PGP key pair directly on the YubiKey hardware, a process that takes 5 to 10 minutes for a full 4096 bit key.
Encrypting a test file for the cold key and then decrypting it proves the YubiKey itself has to be plugged in and unlocked with its PIN before the file will open.
Because the cold key's private half never leaves the YubiKey hardware, an attacker has to physically steal and unlock the device itself, not just copy a file, to ever decrypt with it.
Hardware wallets and encrypting the recovery phrase 7
For everyday cryptocurrency use, a Ledger, about 120 dollars, or a Trezor, about 160 dollars, hardware wallet is the recommended way to generate and hold a 24 word recovery phrase, and Cardano supports both.
The 24 word recovery phrase should be handwritten twice straight from the hardware wallet's screen, then the two copies compared to make sure every word matches before typing them into the secure sandbox.
The recovery phrase file gets double encrypted, first with the cold YubiKey PGP key, then with the hot browser PGP key, so an attacker needs both a physical hardware key and a separately shielded software key to ever open it.
Unlocking the Apricorn drive's PIN keypad and copying the double encrypted file onto it is the only way to carry the recovery phrase out of the secure sandbox.
After double encrypting the recovery phrase, the plan is to leave the secure sandbox, carry the file out on the encrypted drive, and test decrypting it back in an ordinary Windows environment.
A full YubiKey, encrypted flash drive, and Ledger security kit costs a little over 200 dollars total for an end to end wallet recovery phrase protection setup.
In the live walkthrough the encrypted flash drive shows up as a Corsair Voyager GTX rather than the earlier recommended Apricorn model, since either type of PIN pad encrypted drive works the same way.
Backing up and restoring the encrypted keys 7
Exporting the hot and cold PGP secret keys, plus the cold key's public key, onto the encrypted drive creates a portable backup in case the YubiKey itself is ever lost.
Disconnecting the encrypted flash drive and the YubiKey from the sandbox makes both devices reappear normally in Windows, carrying the double encrypted recovery phrase file out with them.
Back in Windows, importing the exported hot and cold keys into Kleopatra, then running gpg card edit again to refresh the YubiKey, restores full access to the double encrypted file outside the sandbox.
Decrypting the double wrapped file happens in reverse order, the hot key's passphrase peels off the outer layer first, then the cold key's hardware PIN opens the inner one.
The double encrypted recovery phrase file is safe enough to email to yourself, since an attacker who compromises the inbox still needs both PGP keys and their passphrases to read it.
Because LastPass notes cannot hold arbitrary files directly, zipping the encrypted recovery phrase with a tool like PZip lets it be uploaded as a note attachment for a second online backup.
For long term physical storage, the advice is to consult a professional safe cracker or locksmith about which safe fits your budget, so the security mindset, sandboxed operating system, salted skeleton key, and double PGP encrypted backups all come together as one complete solution.
Further resources and closing 6
Ross Anderson's Security Engineering, called the bible of information security and of the CISSP certification, is getting a third edition in December.
Introduction to Modern Cryptography by Jonathan Katz and Yehuda Lindell, a contemporary of IOG's chief scientist, is recommended as the bible of cryptography theory.
A free Coursera cybersecurity specialization covering usable security, software security, cryptography, and hardware security, with a full capstone project, takes about a year to complete.
Beyond Ubuntu, security minded users can explore Qubes OS, used by many infosec professionals, hardened FreeBSD, or a free 14 week Linux course taught by Linus Torvalds.
The YubiKey Manager command line tool, YKMan, can generate the static salt password with a no enter flag so it does not auto submit before the rest of the password gets typed.
This lecture is framed as the first step in an endless security journey, alongside mentors like Bruce Schneier and Steve Gibson, meant to help any Bitcoin or Cardano user take control of their privacy, money, and freedom.