So here is the problem, my brother forgot about the eight digit numeric part of his password, he is using Ubuntu 15.04 default whole disk encryption

To make it clear, this was his password (example)


He completely forgot about the 12345678 part, to make things worse it was his working laptop with lot of important documents in it, for "backup" he was using raid 1 so same problem, his boss gave him a month top to recover the data or he is fired, is he screwed?

  • 1
    $\begingroup$ Eight decimal digits should be easily bruteforceable using a somewhat potent machine, if that is your question. But finding someone to do this for you (i.e. job offers?) is not what this site is for. $\endgroup$
    – yyyyyyy
    Apr 11, 2016 at 8:03
  • $\begingroup$ Well that's why I didn't included his email, the money part is for buying resources recommendation, personally I think he should rent top tier GPU cloud computing + hire a specialist developer to set everything up. $\endgroup$
    – D.Snap
    Apr 11, 2016 at 8:12
  • $\begingroup$ @user1179181, buying recommendations are also off topic here, but the question of whether it is possible and how long it would take are on topic. $\endgroup$
    – otus
    Apr 11, 2016 at 11:17

2 Answers 2


We solved this problem in just 9 hours 37 minutes.

Here is how to do it.

Tools you need:

sudo apt-get install cryptsetup
sudo apt-get install dh-autoreconf
sudo apt-get install libcryptsetup-dev

1 - Dump the encryption header of your device using cryptsetup toolset, here /dev/sda1 was our device yours could change:

sudo cryptsetup luksHeaderBackup --header-backup-file headerOutput /dev/sda1

2 - Generate a dictionary with all the possible combinations of the part of the passphrase you forgot; We paid a professional solution for this but there are tons of tools and programming language to accomplish this task for free.

3 - Download and compile this free project (https://github.com/glv2/bruteforce-luks)

wget https://github.com//glv2/bruteforce-luks/archive/master.zip
unzip master.zip
cd bruteforce-luks
sh autogen.sh

4 - Recover your password

./bruteforce-luks -t 6 -f dictionaryYouGenerated yourLUKSHeaderFile

Notice the step "4" will be extremely slow since it utilizes the CPU and the software is not optimized at all, that's why we bought a similar software made for GPU's and we also hired a powerful cloud distributed computing solution (I can't put names here)

In our case the cost of everything was exactly 4400 USD (developer + software + cloud service) Lesson learned from now on we are storing the passphrase printed in a safe so this never happens again. Thank you and I hope this help someone in the same desperate situation.

  • $\begingroup$ Lesson learned should be "keep backups". RAID is not a backup. There's a gazillion other possible ways for things to go awry with the data storage that won't be helped by this approach at all, and using full-disk encryption has a tendency to exacerbate the resultant problems. $\endgroup$
    – user
    Apr 13, 2016 at 14:50

While an eight digit search space is easily iterated, the default settings for LUKS/cryptsetup use a password hash that takes 1s to compute (PBKDF2-SHA1 with iterations chosen to reach that time). That means a brute force of eight digits would take $10^8/60/60/24$ days or over three years on that hardware.

If you assume a GPU is ten times as fast, you will need approximately a hundred days, or 2400 hours, of GPU time. You should be able to rent that GPU time for something on the order of a thousand USD.

You can find the hash value, number of iterations and salt using these instructions.

  • $\begingroup$ I believe is not possible to extract the hash of the disk without first unlock it, or am I wrong? I am trying to help him the best I can by looking at: github.com/mhfan/cryptsetup/blob/master/src/cryptsetup.c specially the tools_get_key() function and trying to compile a program to bruteforce keys, also making the eight digit trys truly random since iterating from 00000000 to 99999999 would be a waste, but sadly I couldn't compile anything yet, if you know a tool already available it would be awesome. $\endgroup$
    – D.Snap
    Apr 11, 2016 at 20:15
  • $\begingroup$ @user1179181, the actual hash is not stored, but the key encrypted with it is. Iterating in order is just as good as any other option if you do not know anything about the number. With random digits you can get collisions so it is worse. $\endgroup$
    – otus
    Apr 12, 2016 at 7:06
  • $\begingroup$ I think the odds would be incremented if he generates a dictionary first randomly with unique numbers of course, it would be trivial to write something like that, he also rented a distributed service for hash cracking of a 10 dedicated servers with I7 6700K and 4 way SLI GTX 980 Ti, the only problem is he couldn't extract the key from the encrypted device yet. $\endgroup$
    – D.Snap
    Apr 12, 2016 at 9:41
  • 1
    $\begingroup$ @user1179181 there is no advantage to a dictionary. An in-order traversal is just as likely to find it in a given time, and easier to arrange and keep track of. Regarding extraction, this document may be helpful. $\endgroup$
    – otus
    Apr 12, 2016 at 11:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.