glv2 / bruteforce-luks

Try to find the password of a LUKS encrypted volume.
GNU General Public License v3.0
238 stars 34 forks source link

Segmentation Fault #33

Closed electronsandstuff closed 5 months ago

electronsandstuff commented 2 years ago

Hey, thanks for this tool! Looks like I might be able to recover the password I lost to an old volume after all.

I see a segmentation fault on ubuntu 20.04 with the most recent version from the master branch. I recompiled it with debug flags and when I run it through GDB I see the following backtrace.

Thread 1784361 "bruteforce-luks" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffcbfff700 (LWP 193429)]
0x00007ffff7c3a8ba in __GI___printf_fp_l (fp=<optimized out>, loc=<optimized out>, info=<optimized out>, args=<optimized out>) at ../include/ctype.h:53
53  ../include/ctype.h: No such file or directory.
(gdb) backtrace
#0  0x00007ffff7c3a8ba in __GI___printf_fp_l (fp=<optimized out>, loc=<optimized out>, info=<optimized out>, args=<optimized out>) at ../include/ctype.h:53
#1  0x00007ffff7c5563a in __vfprintf_internal (s=s@entry=0x7fffcbffbfb0, format=0x555555559088 "Tried passwords per second: %lf\n", ap=0x7fffcbffe670, mode_flags=<optimized out>) at vfprintf-internal.c:1687
#2  0x00007ffff7c58022 in buffered_vfprintf (s=s@entry=0x7ffff7dc75c0 <_IO_2_1_stderr_>, format=format@entry=0x555555559088 "Tried passwords per second: %lf\n", args=args@entry=0x7fffcbffe670, 
    mode_flags=mode_flags@entry=0) at vfprintf-internal.c:2377
#3  0x00007ffff7c54ea4 in __vfprintf_internal (s=0x7ffff7dc75c0 <_IO_2_1_stderr_>, format=0x555555559088 "Tried passwords per second: %lf\n", ap=ap@entry=0x7fffcbffe670, mode_flags=mode_flags@entry=0)
    at vfprintf-internal.c:1346
#4  0x00007ffff7c3fdea in __fprintf (stream=<optimized out>, format=<optimized out>) at fprintf.c:32
#5  0x00005555555568c6 in handle_signal (signo=14) at src/bruteforce-luks.c:99
#6  <signal handler called>
#7  clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:78
#8  0x00007ffff7f25530 in ?? () at allocatestack.c:311 from /lib/x86_64-linux-gnu/libpthread.so.0
#9  0x00007fffcbfff700 in ?? ()
#10 0x0000000000000000 in ?? ()

I am calling bruteforce-luks with the following options:

bruteforce-luks -t 10 -f <dictionary> <luks header> -v 30

I haven't seen a segfault when running with a single thread and so maybe it's related to threading, but I'm not enough of a c programmer to really debug this.

Since it's related to the verbose output, I'm going to try running the code w/o that option and see if there's any issues.

electronsandstuff commented 2 years ago

OK, it's been running with no output for the last five hours with no issues. Looks like the signal handling code is what's causing this.

glv2 commented 5 months ago

This should be fixed in version 1.4.1.