mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #1127] dynamic format can't handle some combinations of interleaving factors #704
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#704
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 (Mar 19, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1127
Originally assigned to: @jfoug on GitHub.
First seen on 32-bit CLANG:
I guess ASan wasn't enabled after all (we should add the alternatives, that's what JTR_FLAG_CHECK is for!)
but anyways
@magnumripper commented on GitHub (Mar 19, 2015):
The "Warning: binary() returned misaligned pointer" is fixed in
84e7319. The segfault is not addressed yet.@magnumripper commented on GitHub (Mar 19, 2015):
@magnumripper commented on GitHub (Mar 19, 2015):
Apparently this did not help (it seemed to help at the time). Then I'm not sure how to fix that, other than to do a tiny alloc at some good spot in the code.
@jfoug commented on GitHub (Mar 20, 2015):
binary() aligned should be fixed here
60090b4@jfoug commented on GitHub (Mar 20, 2015):
Not sure where problem is here. It is doing a 20 byte hex dump (40 bytes) into the input_buf2_X86 array (probably element #0). The input_buf2_X86 is of type MD5_IN. That is a union (double aligned), where it is a buffer PLAINTEXT_LENGTH_X86 + EX_BUF_LEN. I think the size has been hand crafted to be 256 bytes long IIRC. I do not see where the overflow could even remotely be coming from, unless there is some compiler optimization causing issues. The code is VERY hard to read just what it is doing, but I would assume the compiler would have no problems at all 'reading' it.
On your copy, try to remove the inline from hex_out_buf (line 128 or so in dyna_big_crypt). We can NOT run that way. This IS an inline that matters. I just want to see if the problem goes away, forcing the compiler to build a stack frame (well to call a function).
@magnumripper commented on GitHub (Mar 21, 2015):
@magnumripper commented on GitHub (Mar 21, 2015):
Using a debug build
WTF? i is a stack variable. How can it be a pointer to 0x1?
@jfoug commented on GitHub (Mar 21, 2015):
Men overwrite ? Totllen = 1.6 billion. But not happening on other systems. Hard for me yo ddbg when I can't replicate
@jfoug commented on GitHub (Mar 22, 2015):
Now that I do most testing with cygwin64 I've sort of ignored a lot of 32 bit stuff. For a while I was about the only one carrying 32 bit testing on. With all the resent reorg we've done, it's not surprising there have been 32 bit issues popping up
@magnumripper commented on GitHub (Apr 30, 2015):
After all changes to dynamic for AVX2 support, I re-tested this (at
3082d00913) but the problem remains the same.@frank-dittrich commented on GitHub (May 9, 2015):
Looks like https://github.com/magnumripper/JohnTheRipper/issues/1282 is the same issue (32bit Linux with clang)
@magnumripper commented on GitHub (May 10, 2015):
It seems so - I just confirmed the problem is gone in OSX when using gcc.
@magnumripper commented on GitHub (May 10, 2015):
This is about interleaving factors mismatch (as Frank noticed). Here's a failing build
So we use 4x (16) for MD5, 3x (12) for MD4 and 3x (12) for SHA1.
We also use some BLOCK_LOOPS figure, to do more at a time. Let's check them too:
Ok, here's the problem: You can divide 128 by 16 but not by 12. This can be handled in the code of course, but maybe it's not. Let's have a look at a working build:
In this case, we have interleaving factors of 2 and 3, and use a mkpc of 120 which can be divided by any of them.
@frank-dittrich commented on GitHub (May 10, 2015):
Just changing MD5_SSE_PARA in x86-sse.h from 4 to 3 makes all self tests pass on my 32bit Linux AVX2 system with clang.
And the md5crypt and sunmd5 c/s rates also improve:
61568 -> 63504
724 -> 864
@magnumripper commented on GitHub (May 11, 2015):
This may be the whole problem
It only ensures MD5 gets a key per crypt that is a multiple of interleaving factor.
@magnumripper commented on GitHub (May 11, 2015):
That's clang-version dependent and off-topic for this issue. But it should be looked into.
@frank-dittrich commented on GitHub (May 11, 2015):
That would mean the other *_SSE_PARAs would need to be considered here
as well, but I noticed I only need to change MD5_SSE_PARA from 4 to 3 to
make --format=dynamic work for 32bit clang.
@magnumripper commented on GitHub (May 11, 2015):
Sure, because it happened to make it same as MD4 and "compatible" with SHA1. On THAT very system. You could probably have fixed it by changing MD4 to 4 just as well.
What we really need is a least common denominator or whatever. No matter how we tweak this mess, it will be fragile - I think we should actually rewrite some code. This is rather ridiculous.
@magnumripper commented on GitHub (May 12, 2015):
I'm not sure how to attack this. The code is just b0rken, assuming things that really can not be assumed. We've had several problems with this before but only with OpenMP.
@jfoug commented on GitHub (May 20, 2015):
Please test with this patch
290887c@magnumripper commented on GitHub (May 21, 2015):
Works like a champ.