mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #692] Validate that duplicate salt removal is working for all formats #342
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#342
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 @jfoug on GitHub (Jul 4, 2014).
Original GitHub issue: https://github.com/openwall/john/issues/692
We should look for salted formats that do not remove dupe salts properly.
To do this, we can take a set of X unique salts. Dupe the file 5 times, run it and make sure that jtr ONLY sees X salts and not 5X, or any value > X. I know frank recently did some testing on the --list=format-tests Was this behavior 'looked' for when testing. In other words, if there were 4 unique salts, but 16 lines in the input file, are we sure that jtr only displays 4 salts?
I do not have time to do all of this myself, it was just something I thought about, when working on the new zip2 format. This can happen if a format designs a salt in a manner that an exact bit by bit salt value is returned for any identical hash. We did catch some cannonical failures, but did we catch all ?
NOPE. I just tested with pkzip (a format I was pretty sure does not do salt dupe removal properly). --list=format=tests returns 10 lines, but there are 9 hashes (one is a dupe). JtR shows 10 salts. I duplicated the file data 4 times, and it lists 40 salts. So pkzip format needs salt_dup fixed. Can someone carry this forward and at least list which formats are NOT properly salt dupe detecting. When you find Update findings in this message (both proper working and failures, so we known when we have covered them all). Also, could the logic be different on different builds (64 bit vs 32, SIMD vs non, etc? I do not have this answer).
Format's dupe salt removal logic:
@jfoug commented on GitHub (Jul 4, 2014):
This comment brought over from a comment on thread #434
I added a dump_stuff to the end of rar's get_salt, and it appears the get_salt is only being called 5 times, so there is some other dupe removal logic that is also working. Rar 'appears' to have the same issue, where it if the same salt was given to rar multiple times, that it would have multiple salts (all the same). BUT jtr is only giving rar the proper amount, but pkzip (from a --list=format-tests replicated 4 times), gets 4x as many salts.
@jfoug commented on GitHub (Jul 4, 2014):
This 'might' be a PEBCAK, I need to look more. I can not get pkzip format to salt fail now.
nope, certainly not PEBCAK.
Loaded 50 password hashes with 50 different salts (PKZIP [32/32])
Should be 10 of them (10 hashes, file concatenated 5 times).
@magnumripper commented on GitHub (Jul 4, 2014):
RAR has a cludge in cracker.c line 174. It sets a special "pot check salt size" to a lot lower than the real size. Actually it sets it so the REAL salt is checked but not the pointers and other stuff.
@magnumripper commented on GitHub (Jul 4, 2014):
I really dislike changing core functionality if at all possible, but we could add support for this in the format struct. Drop that cludge and announce two salt sizes - one for compare
sizeof(saltstruct.salt)and one for salt buffer copysizeof(saltstruct)(assuming the .salt member comes first in the struct). Normal formats would have them the same size.@jfoug commented on GitHub (Jul 5, 2014):
For some formats that would be wonderful. 'most' probably should check the entire salt size. But some (whihc may allocate a buffer and store a unique pointer which of itself is NOT something that can be compared), BUT which does not play into the salt itself, this would be a benefit.
Ok, by what I saw, I would have assumed rar would FAIL dupe salt removal but it worked. Now that you state rar has 'unique help' in core to do this, it makes sense.
Yes, 2 salt sizes (which default to == to each other) might be something helpful for many formats, which need to allocate something to be 'used' but which is not really 'part' of the salt. IT would also allow a lot more pre-computation of 'crap', BUT not have that affect salt dupe removal, as long as it is at the tail end of the salt record, 'after' the part checked. This is not a trivial design issue, and one that developers would have to understand, BUT it is a very useful addition if used properly. My vote is to add this type enhancement.
@magnumripper commented on GitHub (Jul 5, 2014):
As long as we discuss this on john-dev prior to implementing it, I could live with the core change.
@jfoug commented on GitHub (Jul 5, 2014):
Issue posted to john-dev. Also while typing that email, a (better) thought popped into my head. Instead of having 2 salt lengths, and keeping a dumb comparator WITHIN john core, why not simply make a 'smart' comparator, by making a salt_equal() method??? That way, the format (which KNOWS it's internal structure), could be in charge of saying, yes this is the same, or no something is different....... The fmt_default_salt_equal() is trivial also. It simply keeps the existing code from today, doing the memcmp call.
For formats that store pointers due to variable sized data, having the format do the compare allow it to simply compare the contents of what those pointers are referencing, vs simply skipping them because the actual bytes that make up the pointer(s) themselves are of no value. Also, the format would 'know' that some data may actually NOT be of any comparator value, but was for instance some pre-computed data. A dumb memcmp would not know this, but the format author would (should).
@jfoug commented on GitHub (Jul 5, 2014):
Got a script to test, and here are some 'results', showing the zip problems (script named tst, and I run in dir above jtr's run folder)
$ ./tst zip
there are 2 tests for a total of 10. Any salt count more than 2 is wrong.
Loaded 10 password hashes with 10 different salts (ZIP, WinZip [PBKDF2-SHA1 8x SSE2])
Note: This format may emit false positives, so it will keep trying even after
finding a possible candidate.
Press 'q' or Ctrl-C to abort, almost any other key for status
0g 0:00:00:01 2/3 0g/s 0p/s 3143c/s 3143C/s 123456..bigben
Session stopped (max run-time reached)
Now to just make a for loop to do this, and then look over the resultant output for issues like seen above.
@jfoug commented on GitHub (Jul 5, 2014):
NOTE, if you add a -w=pw (and have a pw file) to the actual john test of the input 2, then zip (and many others) does salt dupe removal correctly ?!?!?!
Changed script to this:
run/john -format=$1 in2 --max-run=1 -w=pw
Now
./tst zip
Testing 'zip' format 2 salts (or less) should be seen
Loaded 2 password hashes with 2 different salts (ZIP, WinZip [PBKDF2-SHA1 8x SSE2])
Note: This format may emit false positives, so it will keep trying even after
finding a possible candidate.
Press 'q' or Ctrl-C to abort, almost any other key for status
0g 0:00:00:00 DONE (2014-07-05 08:30) 0g/s 62.50p/s 125.0c/s 125.0C/s x
Session completed
So here, we can see that there are only 2 (the correct) hashes being tested. I am getting more and more confused with this.......
@magnumripper commented on GitHub (Jul 5, 2014):
Oh you must not run batch mode because the dupe rejection is disabled for Single mode!
@jfoug commented on GitHub (Jul 5, 2014):
why is dupe removal removed for single mode?? This may be the entire issue I am having. If the -w=xxx flag is used, I think all formats are salt deduping (I still need to check things closely). Why on earth would we remove dupe detection?
@magnumripper commented on GitHub (Jul 5, 2014):
Because if you remove a dupe hash you will lose username and GECOS information. Single mode is all about using username and GECOS fields. This is a core thing. Dupe hashes are same salt anyway so "no" speed is lost.
@jfoug commented on GitHub (Jul 6, 2014):
I am back to thinking this may be a PEBCAK, and the dupe problem is mostly in the 'if run in single mode'. I have not tested dyna yet, but I see no issues with other formats as long as they are in wordlist mode, or something other than single mode, it seems. I still think salt dupe removal SHOULD be part of single mode. Yes, you may not want to drop candidates, BUT duplicate salts should be dropped. Take for example 2 hashes, but duplicated in a file 1 million times. Even in single mode, that would crawl, 1 million times slower than it should, along with gaining no information.
@magnumripper commented on GitHub (Jul 6, 2014):
Sure but that is a pretty extreme example. In real world use you'd have a couple of dupe NT hashes which were unsalted anyway. And above all, they share the same bitmap. I do not wish to poke around with Single mode, that is a core thing we should leave as-is IMHO.
For salted formats in real life, any dupe passwords are likely to have different salts.
@magnumripper commented on GitHub (Jul 6, 2014):
BTW I'm not even sure they are not actually removed. It may be just that the figures shown doesn't account for removed hashes because they are still "used" in terms of GECOS etc.
But this is mostly a john-dev discussion with Solar as the only one who actually knows.
@magnumripper commented on GitHub (Jul 11, 2014):
I too think this was a pebcak. The only formats I know of that may have the issue are rar and latest zip, and both now have cludges.