mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #2068] Crash recovery file is locked #1386
Labels
No labels
bug
core branch
documentation
enhancement
enhancement
fixed - pending verify
fuzz bug
good first issue
invalid
invalid
maintenance/cleanup
new cracking mode
new format
new tool
non-trivial
notes/external issues
portability
question
RFC / discussion
testing
WONTFIX
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
openwall/john#1386
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @blackboxbandit-zz on GitHub (Feb 26, 2016).
Original GitHub issue: https://github.com/openwall/john/issues/2068
I've compiled john on cygwin (x64). When i run john with the --fork option, the process doesnt seem to cleanly exit if
and as a result the crash files arent removed. This is a bit annoying when you have john running from a bash script
Im running
john.exe hashes.txt --format=lm --mask=?u?u?u?u?d?d?d --session=SSSF ; stty sane
its running fine without the fork option
John version:
$ ./john.exe
John the Ripper 1.8.0.6-jumbo-1-2087-g35996d5+ OMP [cygwin 64-bit AVX2-ac]
@jfoug commented on GitHub (Feb 26, 2016):
There has been some work on cygwin and record locking.
Btw, I just pushed a commit that gets rid of the need for fixing stty after a -fork run.
github.com/magnumripper/JohnTheRipper@81e0cce630@magnumripper commented on GitHub (Mar 2, 2016):
I'm not sure all signaling is in place in Cygwin. If you press a key for status while running forked, are you getting a status print from each process? Or, if you press 'q' for quitting a forked run - does that work differently from using ctrl-c?
@jfoug commented on GitHub (Mar 2, 2016):
yes
Nope. Both methods work properly and same result. Clean exit.
@blackboxbandit-zz commented on GitHub (Mar 3, 2016):
I've noticed that i do not need to stty, in the new version. Thanks for fixing that!
/john.exe --format=NT-old NT.out --wordlist=../../../wordlists/eNtr0pY_ALL_sort_uniq.dic --rules --fork=8;
5 0g 0:00:01:09 DONE (2016-03-03 08:54) 0g/s 2621Kp/s 2621Kc/s 18055MC/s Zzzrzzzing..Zzzzzzzzzzzzzzzzing 6 0g 0:00:01:10 DONE (2016-03-03 08:54) 0g/s 2607Kp/s 2607Kc/s 17805MC/s Zzzzzzzzzxing..Zzzzzzzzzzzzzzzzzzing 2 1g 0:00:01:10 DONE (2016-03-03 08:54) 0.01417g/s 2594Kp/s 2594Kc/s 17800MC/s Zzzzzzlling..Zzzzzzzzzzzzzzzzzzzzzzzing 1 2g 0:00:01:10 DONE (2016-03-03 08:54) 0.02829g/s 2589Kp/s 2589Kc/s 17797MC/s Zzzzzxzing..Zzzzzzzzzzzzzzzzzzzzzzing Waiting for 7 children to terminate 4 3g 0:00:01:11 DONE (2016-03-03 08:54) 0.04184g/s 2552Kp/s 2552Kc/s 17543MC/s Zzziling..Zzzzzzzzzzzzzzing 3 2g 0:00:01:12 DONE (2016-03-03 08:54) 0.02774g/s 2538Kp/s 2538Kc/s 17301MC/s Zzzuuing..Zzzzzzzzzzzzzzzzzzzzzzzzzzi 7 0g 0:00:01:12 DONE (2016-03-03 08:54) 0g/s 2531Kp/s 2531Kc/s 17314MC/s Zzzjktxrfing..Zzzzzzzzzzzzzzzzzzzzing 8 0g 0:00:01:12 DONE (2016-03-03 08:54) 0g/s 2521Kp/s 2521Kc/s 17305MC/s Zzzzing..Zzzzzzzzzzzzzzzzzzzzing Warning: passwords printed above might not be all those cracked Use the "--show" option to display all of the cracked passwords reliably Session completeduser@HAXTOP /Tools/Password Crackers/JohnTheRipper/run
$ ./john.exe --format=NT-old NT.out --wordlist=../../../wordlists/eNtr0pY_ALL_sort_uniq.dic --rules:Jumbo --fork=8
Using default input encoding: UTF-8
Loaded 15709 password hashes with no different salts (NT-old [MD4 128/128 X2 SSE2-16])
Warning: invalid UTF-8 seen reading $JOHN/john.pot
Remaining 6801 password hashes with no different salts
Node numbers 1-8 of 8 (fork)
Each node loaded 1/8 of wordfile to memory (about 108 MB/node)
Crash recovery file is locked: ./john.2.rec
Crash recovery file is locked: ./john.3.rec
Crash recovery file is locked: ./john.5.rec
Crash recovery file is locked: ./john.6.rec
Crash recovery file is locked: ./john.7.rec
Crash recovery file is locked: ./john.8.rec
Crash recovery file is locked: ./john.rec
Process listing still has john running.
Killing all the john process manually and restarting the job.. i get (Notice forks, 1 and 7 are only going)
$ ./john.exe --format=NT-old NT.out --wordlist=../../../wordlists/eNtr0pY_ALL_sort_uniq.dic --rules:Jumbo --fork=8
Using default input encoding: UTF-8
Loaded 15709 password hashes with no different salts (NT-old [MD4 128/128 X2 SSE2-16])
Warning: invalid UTF-8 seen reading $JOHN/john.pot
Remaining 6795 password hashes with no different salts
Node numbers 1-8 of 8 (fork)
Each node loaded 1/8 of wordfile to memory (about 108 MB/node)
Crash recovery file is locked: ./john.2.rec
Crash recovery file is locked: ./john.5.rec
Crash recovery file is locked: ./john.4.rec
Crash recovery file is locked: ./john.6.rec
Crash recovery file is locked: ./john.3.rec
Crash recovery file is locked: ./john.8.rec
Press 'q' or Ctrl-C to abort, almost any other key for status
1 0g 0:00:00:15 0.07% (ETA: 15:11:36) 0g/s 3684Kp/s 3684Kc/s 26600MC/s wendyannemoffat9..wendyashbyarroyo9
7 0g 0:00:00:15 0.07% (ETA: 15:05:55) 0g/s 3702Kp/s 3702Kc/s 26766MC/s doosjeejsood5..dopasefa5
Using version:
$ ./john.exe
John the Ripper 1.8.0.6-jumbo-1-2129-gf9f31ef+ OMP [cygwin 64-bit AVX2-ac]
@jfoug commented on GitHub (Mar 3, 2016):
Just a couple questions as I try to track this down.
@blackboxbandit-zz commented on GitHub (Mar 3, 2016):
Thanks for the swift response.
My answers :)
3 Updated cygwin this morning.
@jfoug commented on GitHub (Mar 3, 2016):
I do not have an 8.1 any more. I have Win7 at work, and Win10 at home (win10 home and pro). If I can not get this to replicate (NOTE, I HAVE NOT yet tried), then I can probably install an 8.1 on a VM and see if it is OS dependant.
But yes, there are problems with -fork and or with .rec files, with cygwin, and I would LOVE to get to the bottom of it. I have had a few instances of .rec files being full of 'null' bytes. They were about right size, but the contents were smashed. I would really think this is related in some way. I have not had a repeatable way to produce the bug before. Possibly, I can from our instructions.
If I can easily repeat, I can pretty much find about any bug, even if it is just a 'hack' work around. But a hack, if it works, is better than the bug, lol.
@jfoug commented on GitHub (Mar 3, 2016):
One instance ran to completion (like you did), and the 2nd I used the 'q' to exit.
A few questions.
you might want to install TaskInfo or some other tool to have a better look at how much memory each john process is using. NOTE, when using -fork, each instance uses memory, vs OMP, where there 1 1 instance using slightly more memory than a single -fork instance.
@magnumripper commented on GitHub (Mar 3, 2016):
Another datapoint could be the log file. Almost any bailout-ending of JtR should leave some traces in the log file via
error()complete with (iirc) function and source line number.@jfoug commented on GitHub (Mar 3, 2016):
very good point. Other things to look at are:
size of .pot file ?
size of .log file (not sure this matters)
But yes contents of the .log file around the problem time would help.
Also running in -verbose=4 (or 5) may also turn up additional things , or at least better allow tracing where in the process a problem happens.
@blackboxbandit-zz commented on GitHub (Mar 3, 2016):
Entr0py wordlist is from m3g9tr0n one IIRC
$ ls -l /Tools/wordlists/eNtr0pY_ALL_sort_uniq.dic
-rwxrwx---+ 1 User None 872M Aug 29 2012 /Tools/wordlists/eNtr0pY_ALL_sort_uniq.dic*
$ls -l john.pot
-rwxrwx---+ 1 User None 34M Mar 3 19:21 john.pot
I am going to try to run it with traceinfo & -verbose=5. I will also look at the contents of the log / rec file.
Got 16Gigs of memory, so i dont think i am running out of memory
@jfoug commented on GitHub (Mar 4, 2016):
You easily could be running out of memory. Be sure to check. How large is your input file? NOTE, the dict will likely be stored in memory (FOR EACH of the 8 instances!). Also hash lists, hashes, source buffers, etc.
Things add up. 2GB per (or close to that), is not hard at all to hit. I am running john against 6.5m candidates, and am seeing 1.3+gb images, and when running in some modes, I have seen that up in the 2.5gb per node.
@jfoug commented on GitHub (Mar 4, 2016):
I see that the builtin windows task manager also shows memory being used per process also, so that is one way for you to find out, without having to install any additional software
@blackboxbandit-zz commented on GitHub (Mar 4, 2016):
john.log contains the following error messages
1 0:00:00:00 Terminating on error, recovery.c:160
2 0:00:00:02 Terminating on error, recovery.c:160
3 0:00:00:02 Terminating on error, recovery.c:160
6 0:00:00:02 Terminating on error, recovery.c:160
5 0:00:00:02 Terminating on error, recovery.c:160
8 0:00:00:02 Terminating on error, recovery.c:160
7 0:00:00:02 Terminating on error, recovery.c:160
Contents of rec files
$ cat john.*.rec
REC4
9
--format=nt-old
NT.out
--wordlist=password.lst
--rules=All
--fork=8
--verbosity=5
--input-encoding=UTF-8
--internal-codepage=UTF-8
181
0
9fca19a0
c9a
0
7a7fef60
0
7a7fef60
0
0
0
68
0
4902817
0
1288
$ ls -l *.rec |
-rw-------+ 1 User None 205 Mar 4 10:43 john.2.rec
-rw-------+ 1 User None 0 Mar 4 10:40 john.3.rec
-rw-------+ 1 User None 0 Mar 4 10:40 john.4.rec
-rw-------+ 1 User None 0 Mar 4 10:40 john.5.rec
-rw-------+ 1 User None 0 Mar 4 10:40 john.6.rec
-rw-------+ 1 User None 0 Mar 4 10:40 john.7.rec
-rw-------+ 1 User None 0 Mar 4 10:40 john.8.rec
-rw-------+ 1 User None 0 Mar 4 10:40 john.rec
Recreate issue:
$ ./john.exe --format=nt-old NT.out -w=password.lst --rules --fork=8 -v=5
initUnicode(UNICODE, UTF-8/ISO-8859-1)
UTF-8 -> UTF-8 -> UTF-8
Using default input encoding: UTF-8
Loaded 15709 password hashes with no different salts (NT-old [MD4 128/128 X2 SSE2-16])
Remaining 6743 password hashes with no different salts
Node numbers 1-8 of 8 (fork)
Loaded 43 hashes with 1 different salts to test db from test vectors
2 0g 0:00:00:00 DONE (2016-03-04 10:40) 0g/s 2551Kp/s 2551Kc/s 17201MC/s 8whose
Loaded 43 hashes with 1 different salts to test db from test vectors
3 0g 0:00:00:00 DONE (2016-03-04 10:40) 0g/s 2417Kp/s 2417Kc/s 16303MC/s Whoses
Loaded 43 hashes with 1 different salts to test db from test vectors
4 0g 0:00:00:00 DONE (2016-03-04 10:40) 0g/s 3085Kp/s 3085Kc/s 20804MC/s lissaboned..whosed
Loaded 43 hashes with 1 different salts to test db from test vectors
5 0g 0:00:00:00 DONE (2016-03-04 10:40) 0g/s 2553Kp/s 2553Kc/s 17219MC/s qwerting..whosing
Loaded 43 hashes with 1 different salts to test db from test vectors
6 0g 0:00:00:00 DONE (2016-03-04 10:40) 0g/s 3085Kp/s 3085Kc/s 20806MC/s Kerryaed..Whosed
Loaded 43 hashes with 1 different salts to test db from test vectors
7 0g 0:00:00:00 DONE (2016-03-04 10:40) 0g/s 4342Kp/s 4342Kc/s 29279MC/s Paagaling..Whosing
Loaded 43 hashes with 1 different salts to test db from test vectors
Loaded 43 hashes with 1 different salts to test db from test vectors
Each node loaded the whole wordfile to memory
Press 'q' or Ctrl-C to abort, almost any other key for status
8 0g 0:00:00:00 DONE (2016-03-04 10:40) 0g/s 3513Kp/s 3513Kc/s 23688MC/s 5mart..5whose
1 0g 0:00:00:00 DONE (2016-03-04 10:40) 0g/s 4753Kp/s 4753Kc/s 32052MC/s 6spring..6whose
Waiting for 7 children to terminate
Session completed
$ ./john.exe --format=nt-old NT.out -w=password.lst --rules:All --fork=8 -v=5
initUnicode(UNICODE, UTF-8/ISO-8859-1)
UTF-8 -> UTF-8 -> UTF-8
Using default input encoding: UTF-8
Loaded 15709 password hashes with no different salts (NT-old [MD4 128/128 X2 SSE2-16])
Remaining 6743 password hashes with no different salts
Node numbers 1-8 of 8 (fork)
Loaded 43 hashes with 1 different salts to test db from test vectors
Loaded 43 hashes with 1 different salts to test db from test vectors
Loaded 43 hashes with 1 different salts to test db from test vectors
Loaded 43 hashes with 1 different salts to test db from test vectors
Loaded 43 hashes with 1 different salts to test db from test vectors
Loaded 43 hashes with 1 different salts to test db from test vectors
Loaded 43 hashes with 1 different salts to test db from test vectors
Loaded 43 hashes with 1 different salts to test db from test vectors
Each node loaded the whole wordfile to memory
Crash recovery file is locked: ./john.3.rec
Crash recovery file is locked: ./john.4.rec
Crash recovery file is locked: ./john.6.rec
Crash recovery file is locked: ./john.5.rec
Crash recovery file is locked: ./john.rec
Crash recovery file is locked: ./john.7.rec
Crash recovery file is locked: ./john.8.rec
Memory utilization is about 210Meg per instance;
Anything else that you guys might find userful ?
@jfoug commented on GitHub (Mar 4, 2016):
Ok, here is the locking function as cygwin when built without MPI sees things (all crap defines removed)
line-7 is the line I question. We initially setup blockmode to be F_SETLKW (blocking) but then immediately change that to F_SETLK (nonblocking)
@magnumripper you did most work on this. Can you explain, or is this simply a problem, OR was there a problem with F_SETLKW ?
The 'full' code for the F_SETLK override is this:
I am wondering if that hidden if statement should also be addressed with -fork mode work ?
@jfoug commented on GitHub (Mar 4, 2016):
@blackboxbandit can you apply this patch, rebuild and do a -fork test again, checking to see if the problem is there, OR if jtr hangs (or only a thread or 2 actually run).
Note, the change will make the file locking go from non-blocking to blocking, so jtr MAY hang, but I imagine you can kill it properly if that is the case.
@jfoug commented on GitHub (Mar 5, 2016):
@magnumripper I found another comment which seems very important to this discussion:
@jfoug commented on GitHub (Mar 5, 2016):
Testing the new hybrid-external mode, I have been able to replicate this problem!!! I can not have it do it every time, but it does do it, and now that I can do it frequently, I can test 'fixes' myself, looking for what is needed.
here files 1, 3, 4 were locked, 2 was 'working'.
@jfoug commented on GitHub (Mar 5, 2016):
It only seems to happen if the .rec file is CREATED by the file handle that we try to lock. If the file handle was from opening (create) a file that already existed on disk, I see no locking problems.
I will check in a hack. We can talk about how this helps, and what others think about it.
@jfoug commented on GitHub (Mar 6, 2016):
@blackboxbandit please try jtr on cygwin for your setup after applying
9ba87c8I believe it should work without issues under cygwin forking.@blackboxbandit-zz commented on GitHub (Mar 7, 2016):
Downloading the patch now and will let you know how it goes.
@blackboxbandit-zz commented on GitHub (Mar 7, 2016):
Seems to be working fine with the patch; Have had no problems since morning..
Thanks guys for your efforts! Appreciate the quick fix!
@jfoug commented on GitHub (Mar 7, 2016):
@magnumripper didn't we have some other issue a couple years back, where we had to create a file, close it, and then re-open for some issue to go away (cygwin again I think)?? Wasn't it memory mapped files or some crap like that? I do remember something like this. How did we end up handling that issue? was it done in
#ifdef __CYGWIN__manner, or did we just put it into code for all systems to behave that way? (note my memory could be F'n with me also, I kind of partied it up a bit last nite, lol)@magnumripper commented on GitHub (Mar 8, 2016):
I can't remember. Have you searched closed issues here for it?
@jfoug commented on GitHub (Mar 8, 2016):
I think it was at the bottom of recovery.c
@magnumripper commented on GitHub (Mar 8, 2016):
If you mean the close-after-unlink, I added this just some month ago for #1954, which would be a real race condition trigger if implemented.
@jfoug commented on GitHub (Mar 8, 2016):
I still remember something else, but I am not able to find it. There was something about if a file had to be created, that the handle was not usable for something. But simply create file, close it, reopen the already existing file, and things were fine. I am pretty sure this was something in cygwin. We fought to find something for a while, and in the end, a hack like that worked around the problem. For the life of me, I simply can not remember exactly what/where it was.
@jfoug commented on GitHub (Mar 8, 2016):
This may have been an issue I addressed at work. But I remember this.
I do not remember if this was a cygwin only issue. If this was from work, it was likely solaris. Now thinking back, I do think this was our pm process (process manager, that spawns all of our stuff), OR possibly it was that 'runnable' C project where i built so that C code could be executable from the command line. I certainly do not see this in john, but I do remember this problem.
The only question I have, is should we leave the if defs in, or simply make that the default behavior? The actual time used is not all that great, and it is a one time operation. It just makes sure that the .rec file IS on disk.
@magnumripper commented on GitHub (Mar 8, 2016):
No, I wouldn't want workarounds for borken systems in the code for non-borken ones. Besides, the ifdef's serve as a documentation of sorts.
@jfoug commented on GitHub (Mar 8, 2016):
Then lets close this bug, and leave the defines.
This change appears to be needed for cygwin. My question was are there other systems which would need this? That I can not answer, but like you said, the defines list that there are systems which require this type of 'fix'.