mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #2842] Raw MD5 format cannot handle uppercase hexadecimal characters (fixed for CPU, need fix for OpenCL) #1814
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#1814
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 @dnet on GitHub (Nov 2, 2017).
Original GitHub issue: https://github.com/openwall/john/issues/2842
Although it shouldn't matter in case of hexadecimal encoding, the Raw MD5 format not only cannot handle uppercase characters, but the error message is not really helpful.
Steps to reproduce
Using uppercase hexadecimal characters (unexpected behavior)
Using lowercase hexadecimal characters (expected behavior for uppercase)
System configuration
Although the environment shouldn't matter in this case, I'm running this on Debian testing x86_64, I compiled John from
bleeding-jumbo(in this case7c4e6d423).@solardiz commented on GitHub (Nov 2, 2017):
This is on purpose. Not only for
raw-md5, but for many hex-encoded hashes. We actually spent some time cleaning this up some years back, as there were cases where mixed-case hex encodings were accepted and caused trouble later.As to the error message, it results from no format's valid() method recognizing the hash. It'd be tricky and dirty and inefficient to improve upon that. Would we introduce almostvalid() methods or also invoke valid() on lowercased versions of strings? This would slow down loading of multi-million hash dumps, which people fairly commonly do these days.
@dnet commented on GitHub (Nov 2, 2017):
Could you elaborate on this, please?
@solardiz commented on GitHub (Nov 2, 2017):
Speaking of the trouble from different-case and mixed-case hex encodings, when and where those were inadvertently supported before, it was mostly about not always recognizing matching hashes. JtR loader's own duplicate hash check and
--showwould then absolutely depend on comparing the binary versions of the hashes and on relying solely upon the result of that comparison, ignoring the ASCII. And even then we'd continue to confuse various external scripts that people write, or require them to also be aware of this detail.On the other hand, we retained partial(?) support for that by keeping
ldr_cracked_hash()case-insensitive, and we still/again have a similar problem with JimF's dynamic formats where different (or lack of) prefixes could effectively refer to the same hash type - e.g., there are at least 3 different ways in which an effectivelyraw-md5hash can be prefixed in JtR input files.@solardiz commented on GitHub (Nov 2, 2017):
We actually support arbitrary- and mixed-case encodings for some hash types, such as LM and NT, where we unify the case in
split()and set the flagFMT_SPLIT_UNIFIES_CASE. (And IIRC us havingldr_cracked_hash()as case-insensitive is somehow related to that support, but I forgot exactly how. Apparently, there's a code path or use case where non-split()strings reach the loader's hash table.)Now that I've just re-checked, I was surprised to find that we also have this in many of the
raw-*formats, withraw-md4,raw-md5, andraw-md5-flat(maybe some others) actually being exceptions here. This means we do in fact have a valid format-specific issue here, and should fix those formats to be consistent with other similar ones.We should continue not to allow unexpected-case hex in strings that our own
*2johntools generate, or where the target systems themselves use a hex encoding of a specific known case.@dnet commented on GitHub (Nov 2, 2017):
Just to make sure I understood correctly, is the expected behavior handling uppercase hex strings as well? BTW
Raw-MD5u(note the trailingu) handles it this way:@solardiz commented on GitHub (Nov 2, 2017):
Yes, we need to make the behavior of the 3 formats I listed same as for
Raw-MD5uwrt case of hex characters.@solardiz commented on GitHub (Nov 2, 2017):
BTW, this would be moderately easy for a new contributor to implement (maybe as their very first contribution), given that we already have examples in other
raw-*formats. Unfortunately, we don't have a GitHub label to indicate that, although GitHub itself recommends such label names for projects; this could be something we could want to add.@dnet commented on GitHub (Nov 2, 2017):
Sounds great, I'll look into it!
@kholia commented on GitHub (Nov 3, 2017):
@solardiz Custom labels can be added at the following URL,
https://github.com/magnumripper/JohnTheRipper/issues/labels
I am not sure what a good label name would be for such cases. Earlier I used to add
easy-enough/triviallabels to such cases but these labels were removed at some point.@solardiz commented on GitHub (Nov 3, 2017):
GitHub itself runs this ad:
I've just added
good first issueand renamed ourRFC / Help wantedtoRFC / discussionto avoid confusion with GitHub's suggested use ofhelp wanted(which is different from what we meant). We might want to addhelp wantedas well.BTW, in GitHub's ad
help wantedoriginally appeared as red andgood first issueas green, but I didn't keep the page open and don't recall what exact shade of green that was. When I added the label, I chose a certain shade of green and then the ad started displaying exactly that one (I suppose only on our project pages). That's smart of GitHub, yet we could want to stick to use of those colors in case they become familiar to GitHub users from other projects.@solardiz commented on GitHub (Nov 3, 2017):
Or maybe magnum actually meant by the
Help wantedpart ofRFC / Help wantedthe same thing that GitHub means? If so, OK to rename back. I'll leave this to magnum now.@dnet commented on GitHub (Nov 3, 2017):
I submitted PR #2845
@solardiz commented on GitHub (Mar 3, 2018):
FWIW, looks like at least
raw-md5-openclstill doesn't load uppercase hex. I think we missed the-openclformats when adjusting the corresponding CPU ones.@magnumripper commented on GitHub (Mar 3, 2018):
Ideally they'd even use the very same functions for valid, split and binary.