5

I had a disk encrypted by crypto-LUKS but forgotten password. I read a question posted here. LUKS HDD Encryption crack

But before that I want to know if there's some free software I can use to decrypt the password in a more efficient way?

Here's is a tutorial about how to decrypt LUKS password using john the ripper.

But can we use GPU to do the calculation? Will that be much faster for this scenario?

Some suggestions?

Appreciate your comments!

2
  • There's an article here on using your GPU with John the ripper, it all comes down to how fast the GPU itself is, hopefully that points you in the right direction
    – Paradoxis
    Jun 28, 2016 at 11:06
  • @Paradoxis Thank you. Your link contains about how to compile John the Ripper with GPU support. As I can see now, JtR hasn't had support for LUKS decryption yet. In this tutorial , JtR acts only as a password incremental handler, there's no algorithm for LUKS yet.
    – dotslash
    Jun 28, 2016 at 14:33

2 Answers 2

7

It depends what kind of encryption/format you have. Currently, there are many formats which cryptsetup support. Basically, the most popular are LUKS1 and LUKS2. You can check what kind of format you have with following command:

cryptsetup luksDump <device>

John the Ripper only supports CPU cracking with LUKS1 and specific combination of encryption/hash mode. If it is LUKS1, there is GPU support in Hashcat and you can take advantage of GPU cracking. There are also smart optimisations implemented where it does not perform second PBKDF2 which LUKS performs, but it needs to have first sector of the encrypted data ("payload").

Simple benchmark of common LUKS1 format (luks1 type with aes, cbc-essiv:sha256, sha1) that both Hashcat and John the Ripper reveals that GPU (R9 290x) is faster than CPU (i7 2.2 Ghz):

$ hashcat64.bin -a 0 -m 14600 sample-luks example0.dict
[..]
Speed.#1.........:      882 H/s (2.29ms) @ Accel:2 Loops:64 Thr:64 Vec:1

$ john --test=30 --format=luks
Benchmarking: LUKS [PBKDF2-SHA1 256/256 AVX2 8x]... DONE
Raw:    54.8 c/s real, 56.2 c/s virtual

John the Ripper have 54.8 c/s while Hashcat have 882 c/s which is approximately 16 times faster. Of course, there is option to have multiple GPUs per machine, so this number can be quite bigger. Therefore, Hashcat is currently best option to crack LUKS1 format (because of encryption/hash combinations it supports and speed of cracking).

Currently, there is no GPU support for LUKS2 format cracking currently. It does not mean it is not possible, but it is new format and probably just not yet implemented. If you have short list of passwords, you can take advantage of cryptsetup itself:

cat wordlist.txt | xargs -t -P `nproc` -i echo {} | cryptsetup --verbose --test-passphrase open sdb3-to-crack sdb3_crypt

If you need something more robust, it means you're limited to already mentioned tools (in following order):

If you want to read more about the procedure to crack each format, I would advise reading article Cracking LUKS/dm-crypt passphrases I recently written. I have also written that modified cryptsetup. Advantage of modified cryptsetup is that it supports everything what usual cryptsetup support. There are also static binaries of mentioned LUKS2 cracking tools if you want to play with it.

2
  • 1
    Thanks. I think this is the most helpful answer currectly. Sorry for the late reponse :)
    – dotslash
    Feb 27, 2020 at 5:22
  • The xargs command seems to have been broken on more modern linux variants, it will only read the first password from the file now
    – Ferrybig
    Nov 9, 2022 at 13:53
3

There is a program that someone developed that is supposed to be able to crack LUKS passwords by utilizing a GPU, but I don't remember what the name of it was at the moment. I'll try to dig it up.

Also, there are a couple of programs/scripts around that can crack LUKS passwords(bruteforce-luks and Grond), Both of which can utilize multiple threads(CPU cores) which makes them much faster than the example with John the Ripper. I have been able to successfully recover a handful of LUKS passwords with Grond, with the speed ranging anywhere from 1.8-5 passwords a second(depends on the CPU).

If you know most of the password, and have a decent CPU, it shouldn't be too hard.

3
  • Thank you for your clear answer. So you mean the speed grond can provide is at 1.8 - 5 passwords / sec, what CPU ? Will that be too slow. I have several decent CPUs ( say, my servers ). But I forget the combination of the password... Did you try brutefore-luks, how's the speed?
    – dotslash
    Jul 1, 2016 at 17:13
  • I did some testing the other day, with both Grond and bruteforce-luks on an i7 2920XM and I was getting about 1.7-1.8 passwords a second on both. So a desktop CPU should work better, and if the servers have two CPU's + 6+ cores per cpu, it should be even faster. So I don't think it would be too slow. Do you remember how long the password was, what characters were used?
    – Elppa
    Jul 2, 2016 at 15:53
  • note: grond.sh will not work with special characters or whitespace in password easy fix is to change from for loop to while read line;do pw="$line" ... < $WORDLIST May 17, 2017 at 8:44

You must log in to answer this question.

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