is there a way to bruteforce luks?
by - Thursday, January 1, 1970 at 12:00 AM
i have these files that i encrypted using luks a couple of years ago. and now i cannot seem to remember the passphrase/password. is there a way to bruteforce it?
Reply
You could try building python script that bruteforce the password
Reply
It depend on the encryption method of your password. If the algorithm is based on hashing , then it's impossible to decrypt password.
Reply
It will be slow, but you can try something like this :

#!/bin/bash
for PASSWD in $(cat passwords.txt)
do
    echo "$PASSWD"
    echo "$PASSWD" | cryptsetup open --test-passphrase crypted.img cryptmap - && break
done


Not tested, but you get the idea.
Reply
(August 11, 2022, 05:12 PM)darkhero77 Wrote: i have these files that i encrypted using luks a couple of years ago. and now i cannot seem to remember the passphrase/password. is there a way to bruteforce it?


with Pexpect module

passparts = [["t", "T"], ["h"], ["e", "3"], ["_", ""], ["p"], ["a", "4"], ["s"], ["s"]]
possibilities = itertools.product(*passparts)
for x in possibilities:
    possible = "".join(x)
    print possible
    child = pexpect.spawn('udisksctl unlock -b /dev/sdc2')
    child.logfile = open("/tmp/mylog", "w")
    child.expect(".*")
    child.sendline(possible)
    child.expect(".*")
    print(child.before)
    child.expect(pexpect.EOF, timeout=None)
    print child.before
    print child.after
Reply
you can try to write your own app in python using multithreading
Reply
It looks like hashcat has support for bruteforcing luks so might be worth a look. Also found this article on it: https://www.forensicfocus.com/articles/bruteforcing-linux-full-disk-encryption-luks-with-hashcat/
Reply
I'm no expert in cryptography but executing a dictionary attack, and especially a brute force attack, against LUKS would likely take a looong time and require a significant amount of computing resources. I wouldn't bother unless I had a massive cluster with powerful hardware, personally. But I may be wrong.
Reply
(September 8, 2022, 04:23 PM)dongscorp Wrote: I'm no expert in cryptography but executing a dictionary attack, and especially a brute force attack, against LUKS would likely take a looong time and require a significant amount of computing resources. I wouldn't bother unless I had a massive cluster with powerful hardware, personally. But I may be wrong.


I mean no matter the strength of the cryptography it is still worth trying out at least top few thousand common passwords, maybe ones specific for your country etc. Intersection of people configuring luks and having terrible password is probably small but ya never know
Reply
what is it inside? Is it so important? :D
Reply


 Users viewing this thread: is there a way to bruteforce luks?: No users currently viewing.