How to Steal Bitcoins: Part 1 (Cracking Encrypted USB Drives)

This is part one in a series of blogs on cryptocurrencies and security. The goal is to extract data from an encrypted USB stick, like a Tails OS persistent volume. Theses are commonly used for cold storage of Bitcoin, Ethereum, and other alt-coins.

Please note: This is an information security blog. The intent is to help people have fun hacking shit, point out vulnerabilities that we encounter every day, and ultimately help people make better decisions about security. STEALING SOMEONE’S BITCOINS WOULD BE A DICKHEAD MOVE. DON’T DO THAT.

Tools

Cracking these volumes is fairly hardware-intensive, especially when using really long wordlists. For this tutorial, we are using a Linux-based computer with an Nvidia GPU.

You’ll need a few things ready to go:

Hashcat. Get the newest version from this link, some Linux package managers are woefully behind on this stuff.

A text file that contains your encryption passphrase. While you are practicing, just make a short text file with 10 lines in it, one of them being the passphrase you set on your practice USB. Here are some good resources for cracking the real stuff:

First Up - Find the Encrypted partition

You should be booted into your standard host OS right now - not into Tails. Insert the USB stick and wait until your computer recognizes it.

First, we need to figure out if there is an encrypted volume there at all, and if so where it is. You may get an alert right away when you plug the drive in, asking for a password. If so, just dismiss that.

Open up a terminal and use the lsblk command to list all block devices. On my computer, it looks like this:

Yours may not be sda, as that is commonly the boot volume. You should be able to easily distinguish based on the size reported.

The device sda has two partitions - sda1 and sda2. This was created by the Tails Installer, which we happen to know uses the first partition for the boot volume and the second partition for encrypted persistent storage. To verify, we can run the following command and you should see output similar to mine:

Next - Clone the Encrypted Volume

USB drives can be volatile, with many of them being cheap pieces of shit that will lose your data at the worst time possible. Do NOT try to recover encrypted data directly from a USB drive.

We want to make a local copy of our target, /dev/sda2 on our cracking machine. This is easy accomplished using dd. The following command will create a file called “crypt.img” in the local directory.

$ sudo dd if=/dev/sda2 of=./crypt.img status=progress

Once that completes, you can use the same method of checking for an encrypted volume we used above. The new command should like this:

$ sudo cryptsetup luksDump ./crypt.img

The output should look the same as when you ran it directly against the USB stick. Remove that stick now, to make sure you don’t accidentally delete those sweet sweet coins.

Get Cracking - Standard Dictionary Attack

Now comes the fun. Cracking passwords is an art, and consistent success requires really fine tuning your approach. If you want to learn some advanced methods, Google around a bit or check out this great book.

Assumptions:

You’ve downloaded hashcat and placed the files into /opt/hashcat.

You’ve configured your drivers as recommended here. This is important.

You’ve created a short text file, with one potential password per line, your password being one of them. That text file is at ~/wordlist.txt

The crypt.img file is also in your homefolder, at ~/crypt.img.

First, we are going to run a straight-up dictionary attack. This means that password has to be found in your wordlist exactly - with correct case, special characters, etc.

Press the S key at any time to see that status of your cracking session.

If your session completes successfully, you should see an output with your password. If the session completed and you aren’t sure it was successful, running the command as follows will show you all successfully cracked passwords for a given target:

$ /opt/hashcat/hashcat64.bin -a 0 -m 14600 ~/crypt.img --show

If the output of the above command is blank, the password has not yet been cracked.

Getting Tricky - Rule-Based Attacks

As humans, we are pretty dumb when it comes to making passwords. We think doing things like adding an ! or replacing an S with a $ makes them more secure.

When it comes to password cracking, this may slow us down a bit but certainly doesn’t stop us. We can use a pre-defined set of rules for transforming files in a wordlist to many possible permutations.

If you’d like to test this out, use a password like ThisPasswordSucks! for your USB stick, but in the wordlist you create enter only ThisPasswordSucks. This isn’t really stressing your rule list, but you get the idea.