mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #2817] Salt resume problem (potentially severe bug) #1804
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#1804
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 @magnumripper on GitHub (Oct 18, 2017).
Original GitHub issue: https://github.com/openwall/john/issues/2817
Originally assigned to: @jfoug on GitHub.
Since Jim added "salt resume" (which is basically an excellent thing but was never systematically tested), I believe we have the following problem:
Say we run some OpenCL format that happened to auto-tune to 2K keys per crypt and we have 500 salts loaded. After eg. 200 salts, we abort the job.
When resuming, the same format could just as well auto-tune to 4K keys per crypt (due to random variations). The salt-resume code will happily skip the first 200 salts that were "already processed" - but the problem is they all miss 2K candidates which will never be tested. Possible false negatives...
The same thing would happen at smaller scale if eg. running AVX and resuming on AVX2 or running OpenMP and bumping number of threads at resume.
What to do about this? Not sure. Perhaps we could store the active "keys per crypt" in the rec file, and check when resuming that it didn't increase. If it did, we can skip the salt-resuming and just start over from salt 0. As an attempt to avoid that, we might be able to instead ensure the very first batch runs with that same kpc.
@solardiz commented on GitHub (Nov 3, 2017):
This is tricky. I wasn't even aware we had gotten this functionality. I suppose its implementation already has to add storing of the current salt to the .rec file, so we could as well add storing of "keys per crypt".
Meanwhile, we could hide this functionality behind an experimental
john.confsetting (with a comment stating so and documenting this known issue), and have it disabled by default. It's no good to have this bug in a tree that people actually use (we don't have a development tree now - we actually recommend that people use bleeding-jumbo - so we have to be responsible and not keep major known bugs like this exposed by default).@jfoug commented on GitHub (Nov 6, 2017):
I hate to say it, but that is the only sane solution. The resume requires a STATE. Well, when the state is changed (whether by the user, or in this case by john itself), then the resume has to ignore some of its knowledge, reverting it to a safe level. In this case, we will simply have to start the salt resume off at 0, since it would be overly complex to try to back adjust just what is different in the saved 'state'.
This saved_salt logic is REALLY important when there are very VERY slow hashes with a lot of salts. Things like the AM dump. There were 30+ million salts, and just working 3 passwords forward (with BF_X2 properly being set to 3) it would take weeks. So without this salt save logic, if john ran for 10 days, shutdown and restarted, then the first 10 days of the resumed session would simply be replaying 100% done data, and never find anything. But in the exact same logic, but on items which the entire salt level runs in seconds (or even minutes), losing the initially done salts is a non-impact as far as resume is concerned. We just need to know a bit more state information to make an informed decision.
@jfoug commented on GitHub (Nov 6, 2017):
@magnumripper Please try with these patches:
@jfoug commented on GitHub (Nov 6, 2017):
The above simply creates a v2 salt save record. It still processes any v1 salt record properly. It sets the status.resume_salt_crypts_pre to -1 for v1, and then within cracker, the -1 is used as a valid value. BUT on the v2 record, we store max cracks per (we had to expose this in cracker to be used in recovery.c), and then when we get to skipping salts, we ONLY perform that code if the max_keys_per_crypt is still the same as it was when the resume file was made. Easy peasy. NOTE, it would probably be smart to add a logging line here, listing that we wanted to skip salts, but that the runtime state was different.
It could be as simple as they used a different OMP value. Or like you stated, the auto tuning code set up the runtime environment differently. But in any way, in the code presented above, we start from 0.
Now, back looking AT the code, I am still not 100% sure that any values would not have been tested properly. the only 'issues' I see, is if the user re-ordered the input file, thus messing with order of the salts. but since we save the MD5 of the actual salt we left off, and simply move the salt pointer ahead in the list before actually USING them in the loop, are you 'sure' that there would have been data trials skipped???
@frank-dittrich commented on GitHub (Nov 6, 2017):
Wouldn't it be possible to skip salts if the new max_keys_per_crypt is smaller than the old one?
@jfoug commented on GitHub (Nov 6, 2017):
Missed one file needing patched, status.h (added it to the post above)
@magnumripper commented on GitHub (Nov 6, 2017):
I was, but right now (having forgotten some details) I am not. We should try to verify this to 100% certainity. It might even be that the problem occurs in the opposite situation (we resume with a lower KPC than we had). And/or it might actually be mode-dependant to some degree.
@magnumripper commented on GitHub (Nov 6, 2017):
I have little time right now (perhaps next week) but I will try to verify (for SURE) what happens without your patch (and come up with a reproducible test case), and then have a look at it with the patch applied.
@jfoug commented on GitHub (Nov 6, 2017):
I will see what I can do. I will draw up some sample files, then add some debugging (output salt and pw trial). Then run them, then run them using v1 salt resume (prioe to this change), then v2, etc, and make 'sure' we know exactly when this is happening. It is easy to do, just changing the OMP number threads should do it (I think). I can also run using a VC build (2x) bcrypt, and my 3x cygwin bcrypt builds. I am using bcrypt so it is slow enough I can easily get salt resume logic, but fast enough it finishes in a reasonable amount of time.
@jfoug commented on GitHub (Nov 6, 2017):
But the way the salt resume works, I still am not 100% assured that there is a bug to start with. The salt resume simply does a normal resume (i.e. which password to start at), but in salt-resume, no the very first call to the crack block, the code will walk the salt list, looking for the last one processed (salt). IF (and only if) an exact match was found for salt (uses MD5 hashes of the salt, computed one time at load time).
It may be that we have to simply 'back up' the current max count of salt records (minus 1?) I will simply see if I can get enough debugging output to see just WTF actually happens. But I 'think' that by the way 'q' or ^c works, that the current block is completed, and then the resume block is computed, so I would expect that starting at the salt right after where we left off 'should' not cause any chance of a false negative.
@jfoug commented on GitHub (Nov 6, 2017):
I am not able to replicate this. I have tried using bcrypt. I made changes so that the original salt string is stored in the salt also. Then within crypt_all, I perform a loop, print out the salt text string, followed by each password tried. I then built a file with 2500 unique passwords and 2500 unique salts, and ran it. Then re-ran, stopping many times. I then looked at the original debugging file and each of the partials. I looked to the bottom of each numbered partial, found that string. Then searched the original for that string, and then took the line right below it (as the EXPECTED) salt to see starting the next debug file. Each time, I see exactly what was expected.
NOTE, this is using v1 salt resume.
One notable thing I spotted, is that the resume always happens at the very end of a salt (after all passowrds are done) (using the 'q' or ^c). So this test may require waiting for the .rec file to be written, and then killing the file (hard kill, not a 'q'). I do not know. I will test a bit more later and see if I can get this to fail in any way. But all testing done to this point, makes it appear that things are working exactly as expected (for the v1 salt resume). It starts right off where it left off. Before this change, it would NOT resume the salts already done, and would instead replay the entire set of work done on the password set, thus when restarting, it would simply make john appear to hang, when it went through and rechecked all of the already completed salts.
I will try to find the AM data. I may have removed that a while back, so may need to find it somewhere again. That was really good data to test this out. Getting a million (or 10) slow bcrypt hashes, and then only being able to test a few passwords at a time efficiently really showed this bug. When I found it, I had run for about a week, the machine crashes, and then I restarted, and there was simply NO passwords cracked for about a week, then when they started to crack , they were cracking at about the exact rate they should have been. It ended up in this case that the resume was 100% starting over, and was no resume at all.
@magnumripper commented on GitHub (Nov 6, 2017):
OK so let's just reason about this without any hard facts: What, exactly, is stored in the rec file? Say we have a wordlist with 00000...99999 in it, and we run with 500 salts and a KPC of 100. We load 100 candidates (that'd be 00000...00099) in set_key() and then we run crypt_all() with salt 0. Then salt 1 and crypt_all() again, and so on until salt 249, then we abort (soft).
What is now in the rec file? I'm sure the salt is OK, but what is stored in terms of candidates?
I had in mind that we'd have something like "candidates up to x are processed up to salt y". If that's it and we change the KPC, things will (or may) get out of hands.
I'll be VERY happy if we can prove I'm wrong, I'm just not sure (yet) we will.
@magnumripper commented on GitHub (Nov 6, 2017):
Note that this (given a rec file says this at all) implicitly says "all salts has processed all candidates up to (x - kpc) fully". So if we changed the KPC... what just happened?
@jfoug commented on GitHub (Nov 6, 2017):
I do understand the bug, We have this:
passwords loaded 60001 to 62000 stopped processing after salt xxxxxxx Then upon resume, we restore to the 'right' password, but this time, we reload 4k password (600001 to 64000), then we seek to salt xxxxxxx (somewhere in the middle of the salts). However, all prior salts (from aaaaaaa to xxxxxxx do not get passwords 62001 to 64000 tested. But for the life of me, I can not seem to find a way to test this. I have tried different OMP thread counts, etc. Nothing seems lost, but I do understand the reasoning behind this bug, and that we 'should' be missing data. I just need to find a good way to trigger this problem, so that I know if/when it happens that the changes I am proposing will solve the problem (and hopefully do so without displaying the huge problem of doing mountains of work in 100% infertile ground, i.e. work already done, which itself is a very bad thing also.
@magnumripper commented on GitHub (Nov 6, 2017):
Right! Great you get my idea. Perhaps in the end I'm wrong, and that'd be sweet. I'm just very frightened by this very scenario.
Again, the question is "what is actually stored in terms of candidates when we abort"?
@jfoug commented on GitHub (Nov 6, 2017):
I am not sure you are wrong either. But so far, the thing starts out 'exactly' where a full blown run would have, If I concatented all of the partial runs (just the debugging output), it was 100% identical to the full run. Even switching OMP threads. The only difference was the higher OMP count had more 'garbage' at the start of the file (debugging output for the test vectors). But that was 100% expected.
NOTE, when talking about this, I see 100% exactly the same as you were, that we should be missing a TON of candidate trials. But the debugging does not show this. NOTE, this was with 'graceful' shutdowns, not with an arbitrary .rec file being stored, and then the app crashing. I simply hit 'q' then resumed, appending the stderr output to a new file each time, so I could compare results when done.
It is VERY likely that I simply am not using input data that will trigger the bug listed here. Like I said, I would like to test with a know huge monster (way 50k salts from AM) I have simply created some moderately slow BCRYPT using pass_gen. But for the life of me, I have not gotten invalid results so far.
@magnumripper commented on GitHub (Nov 6, 2017):
Trying to get a grip, let's go to extremes. We run some raw OpenCL format doing a 1M candidates per batch. We load 1M candidates (the very first million). We run half of the salts and then we abort. I think what is now stored is we're still at position "0" and we did half of the salts.
So upon resuming (but now with a wee 8 candidates per batch, just for extremes), we're still at "0" but only load 8 in a batch. And then we resume half-way into the salts. This should actually not be a problem (except we are re-doing work).
OK, so far so good. What if we went from KPC 8 to KPC 1M?
We load 8 candidates (the very first 8), we run half of the salts, we abort. Rec file says we're at "0" and through half of the salts. Upon resuming, we load 1M candidates instead, and jump over half of the salts. OK, here's where the problem is. I think this was my original reasoning. We now load 1M candidates instead of 8, but we skip half of the salts even though they were only tested with a wee 8 candidates and not 1M candidates.
@jfoug commented on GitHub (Nov 6, 2017):
Ok, what is stored:
What is stored in the salt block is the MD5 of the salt we just finished. So what happens is when we go into salt_crack_loop (in cracker.c), it gets the 'salt' pointer (i.e the list of salts). These do match order when you rerun the same file. If the user edits the input file, then all bets are off (i.e. the state is NOT what we expect). There is special code and if this is the FIRST call to salt_crack_loop, and there was a salt-md5 stored, then the code knows to move the salt pointer. It simply searched the salt linked list, checking the md5 checksums (created at salt loading time). IF it finds an exact match, then it changes the salt pointer to start from here (i.e. skipping the prior salts, and only doing salts from that point on).
So, here could be some problems.. 1. the stored salt may ALWAYS be the last salt in the list (in my testing). In that case, it would do no tests, and simply go to the next passwords. 2. the stored salt may always be the FIRST salt in the salt list. In that case, the fill list of salts is tested with the new password set. Other than those 2 possibilities, I just can not see how we are testing all possible salt-password pairs that we 'should' be. I will check to see if any of these situations are happening. But like I said, I can literally take the salt-pw pairs from a complete full run, and take the salt-pw pairs from multiple runs, and concatenate those file, and have 100% identical salt-pw files, showing that 100% of the expected salt-pw were tested, and not a single extra one was tested.
So either my expected test conditions are not valid for showing this bug, OR due to other factors (like when / how john makes the .rec files), this is not really a bug even though it REALLY appears to be.
I am out for now. Got a lot of other real stuff to do for now.
@jfoug commented on GitHub (Nov 6, 2017):
sorry wrong button
@jfoug commented on GitHub (Nov 6, 2017):
I am not sure john will allow us to exit in this way. That is why I am wondering if this bug will ONLY show up on a TRUE crash resume ? I will look deeper when I have time.
@magnumripper commented on GitHub (Nov 6, 2017):
Yet I'm pretty sure that IS a normal resume. The rec file stores the position of the last word that is fully tested (with all salts) as well as the salt that was tested with the last batch (note the discrepancy - this is the bug!). If we load the first batch and then abort after half of the salts, the position will still be "zero" or "start of wordlist".
As long as we resume with same KPC, we will seek to zero, re-load the first x words, skip y salts and everything will be fine and dandy. Nothing missed, nothing re-done.
If we resume with 2x KPC, we will seek to zero, re-load the first eg. 2x words, skip y salts and boom, we missed stuff. To be precise the real miss actually happens once we have processed all the remaining salts. John will now write to the recovery file that we did 2x words with all salts. But we didn't.
@jfoug commented on GitHub (Nov 7, 2017):
Ok, I have validated that this bug DOES happen (I was concerned about not seeing it). I built some input files in a specific manner, to make sure it would happen it it could. Well, here are the results (and re-running against the .pot file made no the 2nd run did find the other 20 or so missed passwords
So now I can replicate it. I can start to put code together to make sure that we do not MISS anything, and try to write it so that we have as few redundant tests being done. IT may actually be best to try to run the very first batch using KPC at equal (or less) than what was in the .rec file (but only the first), then from that run forward, use the KPC native to the run. Then I would not have to restart at salt #1, but could continue forward, But that first set of passwords 'might' not be fully optimal, but only that first run.
This testing was done by simply varying OMP_NUM_THREADS (1 2 8 16), and resuming the session.
@jfoug commented on GitHub (Nov 7, 2017):
I will first simply switch over to v2 salt logic that I wrote (ignore salt resume if the KPC changes). Once I am sure that code fixes things, I will see if I can change the first leg of work to use a possibly reduced KPC. Then If both methods work, I will see which method is better than the other. But I think it will end up being that there are times which one method will be better, but other times when the other method is better.
Ok, first test. The code listed above (v2 salt restore). Things worked fine. Running a full session finds 120 passwords, resuming finds the same 120 passwords. There was noticeable delays at resume time, before passwords started to show up, since we were re-running already partly worked data (when we expanded the KPC). Here are the counts of salt-passwords tested:
So the counts done on the restart were higher, using this method (the re-run of already tested data). But in the end all passwords were cracked, and the bug pointed out here is handled.
I will work at the reduced KPC on first loop on restart, and see how that works. It should not show any noticeable delay kicking out the first passwords after resume. BUT that first block of code may be sub optimal, since it is not full.
@jfoug commented on GitHub (Nov 7, 2017):
Note to self. We also need to make sure that the ET is properly handled (either method we settle on using)
@jfoug commented on GitHub (Nov 7, 2017):
Ok, doing reduced KPC on first resume run was pretty easy also. In this model, you do NOT see any delay for the first crack, since there is no work being redone. The downside is that the first salt loop will be run with the same count as what was in the resume file (if we have more KPC now), but on all the remaining salt_loop calls, we will be at full KCP
Note, there are a few missing tests in the resume with this method. I need to check why. It looks like either we are starting the salt after where we should be or something. BUT I do like this 'feel' of this method better. It does not have the large delays the other restore does. Appearance to the end users do matter ;) If they have been seeing a couple cracks per minute, resume, and then do not see ANYTHING output for several hours, they will think something is wrong, even it it is not and simply john working around this bug. But if done by lowering the KPC on the first loop, if they were seeing cracks every couple minutes, then they should start seeing cracks shortly after starting.
here is cracker.c (the other patches shown earlier in this post are still valid). This would not be a complete patch here. I simply commented out the if statement in the salt_loop. If we go with this method, that if statement simply would not exist, and the original salt_crack_loop would be used.
@jfoug commented on GitHub (Nov 7, 2017):
Digging deeper, there may be no issues at all (counts not matching), on the last method (the reduced KPC). It looks like salts may have been removed at different times based upon method. I think I will re-run the tests where I have no passwords in the input file that crack anything. Then we will see if the counts match. But right now, even with the unexpected count mismatch, I think the code is correct.
@jfoug commented on GitHub (Nov 7, 2017):
Also, we may be able to put the computation of max_keys (it would have to be global or static), and only do that in the
block of code (i.e. so we do not have to preform that computation every salt/pw pair. But I will not do that unless @magnum thinks it is the right place to move that code.
@magnumripper commented on GitHub (Nov 7, 2017):
Excellent! I have little time now and haven't looked much at your latest diffs, but here's some thoughts from yesterday & today:
@jfoug commented on GitHub (Nov 7, 2017):
Ok, I feel good now. The new method finds the exact same salt-pw list. It did have a few duplicates. I think there were dupes when I shut things down before the first run block completed, and then started it again with a different OMP level. BUT i the end, all salt-pw pairs were processed
@magnumripper commented on GitHub (Nov 7, 2017):
Actually, if we feel any uncertainity about Single mode we could simply disable salt resume for it. Since it runs so totally different, I'm pretty sure there's little penalty on resume anyway (and when there is, it's for other reasons than the normal "many slow salts" case). @solardiz does this make sense?
@jfoug commented on GitHub (Nov 7, 2017):
This will remove any salt-resume for older john. Yes, we can easily add that. I already know it is v1, since there is a -1 in there for the prior run KPC. This is a trivial change.
I will have to think about how to test this one. It may be that my method of detection (code changes to crypt_all for bcrypt will work just fine. The code I inserted is this:
If that code is all that is need, I should be able to test single mode. NOTE, I am not 100% sure how this will play out in single mode. Is the call to the salt_loop function even used??
@magnumripper commented on GitHub (Nov 7, 2017):
Me neither. No, I think it's not - Single mode runs very very differently than anything else seen in any cracker I know of.
@jfoug commented on GitHub (Nov 7, 2017):
I think the only time salt resume would raise its head, is if there were multiple same salts (I could be wrong). I think the single mode works on each hash independently. Now, there MAY be issues when the single mode does the 'replay of cracked passwords. But I will assure you, there IS serious problems on resume there. The single mode is wholly based upon built up facts happening during the run. We have no way at all (currently) to save the entire state needed to properly resume single mode anyway.
@jfoug commented on GitHub (Nov 7, 2017):
The only real 'resume' in single mode, is to know that we have worked up to hash #x in single mode. The 'extras' done likely are not getting restored properly.
Single is SOOOO powerful, but difficult to add recovery code to.
@jfoug commented on GitHub (Nov 7, 2017):
Ok, I will do this:
I will look a bit at single mode, just to make sure this salt resume does not impact a resume, prior to checking the above code in.
But yes, this certainly was a bug. Both corrective methods worked around the bug, but I think the reduced KPC is the better 'fix' to allow keeping the salt resume logic.
@magnumripper commented on GitHub (Nov 7, 2017):
Yeah, keeping salt resume with varying KPC is awesome. In case of OpenCL, it will normally not even mean any significant speed drop for the first run with "reduced" KPC. Very effective. Really good stuff.
@magnumripper commented on GitHub (Nov 7, 2017):
I think it's something along these lines, very simplified.
Normal crack:
Single mode:
This is not quite it, but it shows the huge difference. @solardiz can you describe it better?
@jfoug commented on GitHub (Nov 7, 2017):
That code (if improved to be correct), is VERY VERY helpful. Thanks for simplifying things. there is some logic to 'create;' the salt-specific candidate word somewhere. I think that happens before the apply_rule() block, while at the same time, the 'normal' code it happens within wordlist at load time. So it may be more like:
single mode:
@jfoug commented on GitHub (Nov 7, 2017):
NOTE, I do not remember if the build-local-words was done within the runtime loop, or done at load time (I think it was at load time, IIRC). But I do think there was a foreach(local_word) loop missing before the apply_rule tag.
If @solardiz would correct this, and also using this format, show how the replay of found cracks plays into the single mode. But simple pseudo docs like this would be fantastic to take the mystery for me out of single mode (and would make great additions to the github wiki)
@magnumripper commented on GitHub (Nov 7, 2017):
It's at load-time. Each salt has a list (a
list.clist) with candidates made from login and gecos fields (and others) as well as pairing of them and other combinations (like initials).So instead of a wordlist for all salts, we have a wordlist per salt.
@magnumripper commented on GitHub (Nov 7, 2017):
Actually it's more like this (I think). Each salt has a buffer that can hold KPC:
@jfoug commented on GitHub (Nov 8, 2017):
So, when a crack happens, the code simply spins through all buffers, and calls the
to each salt's buffer?
Also, is your
code where we get the gecos split words for each user?
@magnumripper commented on GitHub (Nov 8, 2017):
Either that, or it's a global list. Either way, I have absouletly no idea just how THAT part would resume (even in core John). Should be easily found if we follow the code for
SingleRetestGuessed.IIRC all that happens during loading. But pre-made word pairs (the ones that work even with
--single=none) are possibly made closer to the inner loops.@magnumripper commented on GitHub (Nov 8, 2017):
Note that we have a per-salt candidates list (that is static and populated while loading), and a per-salt buffer for next batch of keys for crypt_all for that salt. They are two separate things.
@jfoug commented on GitHub (Nov 8, 2017):
It does not resume well. Try it. Get a decent set of data which single will crack about 25%, but that takes an hour or so to run. Run it to completion. Then run it again, but to a different .pot file. Break every 10 minutes, resuming. What you will get in the end will not be the same .pot file. It will still crack a lot, but not all that would have been cracked.
For single mode, it is best to really let it run to completion. IMHO, the default for single should NOT re-insert the cracked candidates (at least in jumbo). what should happen, is single should work to quickly run all the gecos data against the proper hashes. THEN, when completed with single, re-run john in loopback mode, with better rules than the single. Doing this is quite a bit faster (especially for single), and it ends up finding more values than auto retest in single mode. Some of this some depends upon the speed of the hash, but more importantly, if you plan on running john in loopback mode at some point. IF that is the plan, then the retest within single is wasted time (or the retest of these values when doing the loopback is wasted time). Just my $0.02 worth of usage insite.
@ghost commented on GitHub (Nov 9, 2017):
I'm trying to demonstrate a situation where JtR restore logic seems to stop to try the next new candidates.
OMP_THREAD_LIMIT=1)../run/john -mask=?w?d?d -w=bitcoin_restart_rules_tst.dic bitcoin_restart_rules_tst.in -form=bitcoin -max-run=20Loaded a total of 2000 password hashes with 2000 different saltsversus:CI: stuck on 5%:
Super: stuck on 10%:
@magnumripper commented on GitHub (Nov 9, 2017):
In some cases
-max-run=20will be too short for any real work to actually happen in a run. Perhaps-max-run=60will be free of this problem?@jfoug commented on GitHub (Nov 9, 2017):
This I believe is the exact same type situation which first pushed me to implement the salt-resume code. When the run is against VERY slow candidates, and with a lot of salts, then ETA does not move at all, until the entire block of salts is done for the KPC passwords selected. When I was working on the AM stuff, I was seeing times of several weeks (months??) before the loop completed and the ETA changed. Any session save during that time frame would start then entire block of passwords over at the start of the salts. Simply unacceptable.
now, for the ETA screen being 'stuck'. I think that is an open issue (at least it was 2 years ago). It is all based upon when the computation for that is done, and now we are starting to see these spectacularly slow dumps of many hashes. Years ago, a hash which you could only do a couple thousand cracks per second was considered slow (like md5crypt). Now there are salted hashes which take nearly a second. When you get a large dump of them, john has some design items which cause it to appear hung. I am not sure just how much of that we 'want' to fix since we also do not want to harm super fast hashes either (which is often what a cracker gets reviews over). UNLESS we make changes to list that this hash is a fast, medium, slow, or SUPER SLOW hash, and handle things slightly differently for each. For a super slow hash, updating ETA after every crypt_all may make sense, it does not slow down the run at all. BUT for a fast hash, that would greatly impact speed.
NOTE, this may be the wrong location to chit chat about this.
@ghost commented on GitHub (Nov 9, 2017):
I'm afraid I am going to have to disagree. The same crack session using a pure mask [1] finishes in a couple of minutes. It can crack 100+ hashes per run.
I'll be running the "hybrid" mode to find out how long does it take.
[1]
@solardiz commented on GitHub (Nov 9, 2017):
Good job figuring out the single mode!
Exactly. And there's also a check whether the buffer is full, where some very limited recursion may occur.
And yes, interrupting and resuming the single mode doesn't produce the exact same results because of those recracks. And yes, they make less sense when someone experienced uses jumbo, but they still do make sense when someone inexperienced does and the hash isn't terribly slow along with large salt count. I don't oppose us changing the default, though.
What Jim says about marking hashes as fast or slow, etc. makes sense to me. We could have this affect various things, but for anything that would result in different passwords (not) getting cracked we should inform the user ("Notice: ..." messages?) In many cases, the slowness will also vary a lot by the tunable costs, which makes things a lot trickier. So maybe base runtime decisions on actual measured c/s and/or p/s rates, where relevant? Can't use these before even starting a cracking mode, though - let alone in the loader.
@jfoug commented on GitHub (Nov 9, 2017):
But since a ST is done prior to starting, we could do a bit of a ST (a couple seconds), and then use the c/s p/s rates. Then it would allow setting what 'is' a fast, what is a 'slow' in the john.conf file. Like you mention, if tuning is done, it can change a hash from slow to medium. the same format running on a AVX512 vs running on something that is forced to use oSSL CTX models can be an order of magnitude or more different in speed. So getting 3 'buckets' (fast, medium, slow), and then determining at runtime just what we have, would provide more information for changes in the runtime behavior.
there certainly are times when the play-back found in single is really the wrong default. In the VERY slow AM format, it simply meant that a single mode run would take decades (possibly centuries), vs weeks. It really was that big of a difference. Yup, at the end, there would be a lot more passwords hacked, BUT that end never would have gotten here. It was first noticed, when I was getting 4 to 10 cracks per minute, and then after a while, that just appeared to stop. Yes, there would be a couple hundred cracks per day, but not much more. It was at a point where there were millions of 'full' by salt buffers, and no more single data was being tested. It happened when 1000's of salt-buffers filled up, and had to be satisfied prior to more single data being dropped off in salt buffers.
This would certainly not be the only area where super fast vs super slow processing could be looked at differently. Certainly, things like computation of ETA is another very ripe area, where there is great need to different logic. I bet there are numerous other parts of john, where the runtime characteristics could be variable based upon type of data, giving the user better end results, OR better 'smoother' running and usability.
@ghost commented on GitHub (Nov 9, 2017):
Back to the stuck on restore
Since I can't find a bug, I'll do this.
[1] with KPC = 64 and 8k c/s (C/s), mask should finish one set and move to another. That said, thinking about a 1M bitcoin hashes, the
--restorewill be a problem even for a real prospective run.