4

i am stuck with a big problem.

I have encrypted my linux drive with LUKS and now I can't remember it. During boot, it prompts me for the passphrase, but I went into troubleshooting mode and deleted the entry from /etc/crypttab so at least I can boot now into my account but that doesn't solve the problem. I can't access my drive /dev/sda5.

Can someone please show me a way to crack the passphrase or is there no way around it.

migrated from stackoverflow.com Sep 19 '12 at 9:21

This question came from our site for professional and enthusiast programmers.

  • how long is the passphrase roughly ? If its short, you may be able to brute force it, but other than that, you're hosed. – Sirex Sep 19 '12 at 22:14
  • @Sirex: LUKS uses a key derivation function, making brute force much more difficult. It would have to be a very short passphrase. – Dietrich Epp Sep 19 '12 at 23:03
  • 1
    It's your LUKSy day. Encryption works, the bad guys can't access your data. And if you aren't careful with passphrase management, neither can you. It's working as designed. – Fiasco Labs Apr 21 '13 at 17:05
  • <p>I hope its not late, and for other users with same issue,</p> <p>there is a nice vulnerability in <strong>Cryptsetup</strong>, stated in "<strong>CVE-2016-4484</strong>" that in many cases you can keep pressing "Enter" for at least 90 times instead of passphrase and you will get a <strong>root shell access</strong>.</p> <p><br />you can also check these videos in YouTube:<br />youtube.com/watch?v=10YyqD6lTBk<br />youtube.com/watch?v=wSS6sa7HgIE</p> – samphone Aug 23 '17 at 4:37
  • 1
    @samphone That does not mean it will decrypt a volume, because you didn't supply it with the correct passphrase by just pressing Enter. It may give you a root shell, but without unlocking the data on the encrypted volume. Moreover, that's what the OP already figured out in the proper way; he can access his machine/account already. Please read the Q first. – gertvdijk Aug 23 '17 at 8:19
14

There is no way around it. That the whole point of encryption in the first place.

You will have to erase the partition and start over, all data is lost.

  • Thanx can i get a second opinion anyone?? :-/ !! – Ansh David Sep 19 '12 at 10:32
  • 8
    @AnshDavid: I don't think you really understand the whole "encryption" concept. Encryption is specifically designed to prevent you from accessing the data without the passphrase, that is the one and only purpose of encryption. – Dietrich Epp Sep 19 '12 at 10:52
  • @AnshDavid: Okay, here's the second opinion. If you encrypt something with a passphrase, you do it to make sure that no one with no means has access to that data unless you give them the passphrase. That "no means" part is quite literally...if you forget your passphrase, you have a problem. That you can't recover the data or the passphrase (but for remembering or guessing) shows that the encryption is working as it should and was designed to. – Bobby Sep 19 '12 at 12:44
  • ...thanx @Bobby – Ansh David Sep 19 '12 at 19:38
5

Unless you chose to make a backup of the encryption key during the installation (if installed using the alternate installer of Ubuntu for example), then you're the only capable of decrypting the key on the disk to unlock the volume.

No way to recover from the volume. Recover from backups.

As @DietrichEpp mentioned: this is the whole point encryption in the first place. Nobody should be able to read your data unless the correct key/passphrase is provided, including yourself.

  • 3
    +1 for "Recover from backups." If you don't have backups, you're doing it wrong. – Michael Hampton Apr 21 '13 at 17:42
  • Even just a LUKS header backup is good, it's only 1 or 2MB and it's still password protected (unlike the cleartext encryption key), useful for when just the start of partitions get overwritten and it would be nice to still read all the remaining data (gigs/teras) that might still be untouched. – Xen2050 Jan 13 '18 at 8:43
  • If you don't have encrypted backups, you don't have encrypted data ... – Julie in Austin Jan 3 at 19:59
5

I have created a Windows program that will perform a dictionary attack on Luks volumes. http://code.google.com/p/luks-volume-cracker/ Its slow by design!

  • You mean LUKS is slow to dictionary attack by design, right? It looks like you're saying the program you wrote/created yourself is intentionally even slower... Why would you do that? – Xen2050 Jan 13 '18 at 8:36
  • Yes that's right LUKS itself is slow by design. That said - my program would likely be slower than the the other crackers too - the only advantage would be if you wanted to do it on Windows – chris Jan 14 '18 at 12:51
3

Use brute-force if you remember enough information about password. I wrote script that call

echo 'passwordcandidate' | cryptsetup luksOpen /dev/sda5 test

If the exit code is 0 then the password is correct. If the exit code is 2 try next. With 4 threads on 4-core CPU the speed is 1 password/s.

The fastest method to brute-force the LUKS disk I found is Hashcat. Now it supports LUKS. Example for the combination of two wordlists:

hashcat64.bin -m 14600 -a 1 /dev/sda5 start.dict end.dict

On my GeForce GT 720M the speed is 50 password/s.

If you have access to the more powerful computer, you can take only the first 2 MB from your luks-disk.

dd if=/dev/sda5 of=luks-header-hashcat-sda5 bs=512 count=4097
hashcat64.bin -m 14600 -a 1 luks-header-hashcat-sda5 start.dict end.dict

Read more https://hashcat.net/forum/thread-6225.html

  • cryptsetup's luksHeaderBackup command saves the header too, without any math or dd (so it shouldn't accidentally overwrite your drive if you accidentally transpose options... and why not use bs=1M count=2 anyway? You're taking an extra half k with 512 & 4097) – Xen2050 Jan 13 '18 at 8:39
1

If you used to remember the password and have forgotten it, chances are you remember some information about it (length, some symbols used, some symbols not used, etc), that could make it feasible to brute-force. Even with the astonishingly slow speed of 1.3 seconds per attempt that I get using the naive and slow method of calling 'cryptsetup luksOpen' repeatedly.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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