mirror of
https://github.com/openwall/john.git
synced 2026-12-03 20:43:49 +07:00
[GH-ISSUE #652] haval-128-4 needs to store canonical hashes #312
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#312
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 @frank-dittrich on GitHub (Jun 20, 2014).
Original GitHub issue: https://github.com/openwall/john/issues/652
Similar to issue #644 (which was for MD2)
valid hashes should be converted into their canonical representation (with the
havalprefix).@frank-dittrich commented on GitHub (Jun 20, 2014):
But (unlike the MD2 fix for #644) IMHO the conversion should be done in split(), not in prepare.
@jfoug commented on GitHub (Jun 20, 2014):
I know you are making 1 off's for these, BUT this is an absolute bug, for most formats.
If a format handles this:
hash
$somesignature$hash
then it MUST have a prepare() function. It is simple as that. This is as basic as a format requiring a split function to fix the case if it is supposed to handle:
hash
HASH
The Haval format is certainly one of these, but there are probably a hundred or more. Using your method of --list=format-tests is NOT going to find them all. Yes, it will find some, but certainly NOT all.
About the only way to deal with this, is to look at code. The thing is, that it takes only a few seconds longer to add a 'proper' prepare, that it does to find out if a format requires one ;)
Jim.
@frank-dittrich commented on GitHub (Jun 20, 2014):
Meanwhile I have finished all the CPU formats.
That means, all other CPU formats that do have the same hash in at least 2 different representations (once in a canonical representation, once in a more general representation, etc) work correctly (either split() or prepare() does the unification.
So, if there are other CPU formats with similar problems, they either don't have different representations in their test cases, or they do use different representations, but not for the same hash.
I'll also do the same tests for cuda and opencl.
But I expect at least those opencl and cuda implementations which have a broken CPU format to be broken in sinilar ways.
@jfoug commented on GitHub (Jun 20, 2014):
1eee4affixes the prepare. Also, I split the valid function into 2 of them. I found problems when I had a 'mixed' file, containing both haval-128-4 and haval-256-3 strings. All would get accepted as valid, even though only the proper ones would work in the crypt function. With 2 valids (there still is a 'common' valid), then this does not happen, and with prepare, the format reduces to proper cannonical values.@jfoug commented on GitHub (Jun 20, 2014):
ANY time we see code like this (in valid, salt, binary, etc), then we have a format that can do raw hashes, there are also other ways to do it, but this is one way I am seeing;
The important part that shows 'raw hash' handling, is the p += TAG_LENGTH. The actual code may be a little different (ciphertext var name, vs p, some len var used instead of TAG_LENGTH, etc). But in general, this type of code SHOWS that this format has a format tag that is OPTIONAL. If it is optional, then there SHOULD be a prepare, that cannonizes the format.
Jim.
@jfoug commented on GitHub (Jun 20, 2014):
This is a good place to start (it will likely NOT be complete)
NOTE, I am going to edit this file, as I check these files.
@ghost commented on GitHub (Jun 20, 2014):
rawSHA256_common.h too? At least, in this case there is a split() and a prepare().
@jfoug commented on GitHub (Jun 20, 2014):
These are pretty much handled now. NOTE, these may still need to be looked into:
whirlpool_fmt_plug.c
tcp_md5_fmt_plug.c
rakp_fmt_plug.c
opencl_rakp_fmt.c
Some of these may simply want to bail from valid if the tag is not there. Whirlpool has issues, due to not having a default type for raw hashes.
I am leaving this one open for now.
@jfoug commented on GitHub (Jun 20, 2014):
Yes, I looked at that one too. It simply was not in my grep. But it IS already handled by split.
@jfoug commented on GitHub (Jun 20, 2014):
These are the commits:
a50d2b65e11b5cb2c6003@magnumripper commented on GitHub (Jun 24, 2014):
There are lots of bugs in HAVAL (and dozens of @kholia's other formats). First, a 2x too large binary size is announced for the 128-bit variation of the format. I'm pretty sure this means core can't reliably suppress dupes. Second, split() does not unify case but valid() accepts any case. This means some already cracked hashes will not be recognized as such. Third, none of the cmp_*() functions check the whole hash for the 256-bit version (just half of it). That might not be a very serious bug but it is indeed a bug. There are probably more problems, and this is just one format out of too many.
BTW the format should have several more test vectors, including one for a null string and one for max length.
I will commit some fixes soon.