[GH-ISSUE #1746] Dynamic ad-hoc formats failing from fuzzer #1154

Closed
opened 2026-10-14 03:37:01 +07:00 by bsakaguchi · 5 comments
Owner

Originally created by @magnumripper on GitHub (Sep 11, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1746

Originally assigned to: @jfoug on GitHub.

First one from the dynamic fuzzer that fails:

$ ../run/john -test -form:'dynamic=md4(MD4($p).$s.md4($p)),debug'
push
push
app_p
f4H
.
app_sh
.
push
app_p
f4h
f4h

crc32 = 07023FDB
pExpr=md4(MD4($p).$s.md4($p))
extraParams=,debug
signature=@dynamic=md4(MD4($p).$s.md4($p)),debug@
line0=@dynamic=md4(MD4($p).$s.md4($p))@ee42213df9cba9153d42c226f0daf9c2$719a288e
line1=@dynamic=md4(MD4($p).$s.md4($p))@7fb0bf5fe7ba047508b6fc03361f23d1$3d85c237
line2=@dynamic=md4(MD4($p).$s.md4($p))@d691bcd654a62b3db1d9363726d85f60$7184f1d5
line3=@dynamic=md4(MD4($p).$s.md4($p))@5b306463764d0e4cb43d8ef7d6879348$85b68792
line4=@dynamic=md4(MD4($p).$s.md4($p))@b6c89de455aef85fcc552dafdd91e8a1$83213d35
##############################################################
#  Dynamic script for expression md4(MD4($p).$s.md4($p)),debug
##############################################################
Expression=dynamic=md4(MD4($p).$s.md4($p))
#  Flags for this format
Flag=MGF_FLAT_BUFFERS
Flag=MGF_SALTED
#  Lengths used in this format
SaltLen=-32
MaxInputLenX86=110
MaxInputLen=110
#  The functions in the script
Func=DynamicFunc__clean_input_kwik
Func=DynamicFunc__LargeHash_OUTMode_base16u
Func=DynamicFunc__append_keys
Func=DynamicFunc__MD4_crypt_input1_overwrite_input2
Func=DynamicFunc__LargeHash_OUTMode_base16
Func=DynamicFunc__append_keys2
Func=DynamicFunc__MD4_crypt_input2_overwrite_input2
Func=DynamicFunc__clean_input_kwik
Func=DynamicFunc__append_salt
Func=DynamicFunc__append_input_from_input2
Func=DynamicFunc__MD4_crypt_input1_to_output1_FINAL
#  The test hashes that validate this script
Test=@dynamic=md4(MD4($p).$s.md4($p))@ee42213df9cba9153d42c226f0daf9c2$719a288e:abc
Test=@dynamic=md4(MD4($p).$s.md4($p))@7fb0bf5fe7ba047508b6fc03361f23d1$3d85c237:john
Test=@dynamic=md4(MD4($p).$s.md4($p))@d691bcd654a62b3db1d9363726d85f60$7184f1d5:passweird
Test=@dynamic=md4(MD4($p).$s.md4($p))@5b306463764d0e4cb43d8ef7d6879348$85b68792:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEF
Test=@dynamic=md4(MD4($p).$s.md4($p))@b6c89de455aef85fcc552dafdd91e8a1$83213d35:

$ ../run/john -test -form:'dynamic=md4(MD4($p).$s.md4($p))'
Benchmarking: dynamic=md4(MD4($p).$s.md4($p)) [128/128 AVX 4x3]... FAILED (cmp_all(1))

I'm not 100% sure the problem is in the new test vectors or an actual bug, but it looks like the latter.

Originally created by @magnumripper on GitHub (Sep 11, 2015). Original GitHub issue: https://github.com/openwall/john/issues/1746 Originally assigned to: @jfoug on GitHub. First one from the dynamic fuzzer that fails: ``` $ ../run/john -test -form:'dynamic=md4(MD4($p).$s.md4($p)),debug' push push app_p f4H . app_sh . push app_p f4h f4h crc32 = 07023FDB pExpr=md4(MD4($p).$s.md4($p)) extraParams=,debug signature=@dynamic=md4(MD4($p).$s.md4($p)),debug@ line0=@dynamic=md4(MD4($p).$s.md4($p))@ee42213df9cba9153d42c226f0daf9c2$719a288e line1=@dynamic=md4(MD4($p).$s.md4($p))@7fb0bf5fe7ba047508b6fc03361f23d1$3d85c237 line2=@dynamic=md4(MD4($p).$s.md4($p))@d691bcd654a62b3db1d9363726d85f60$7184f1d5 line3=@dynamic=md4(MD4($p).$s.md4($p))@5b306463764d0e4cb43d8ef7d6879348$85b68792 line4=@dynamic=md4(MD4($p).$s.md4($p))@b6c89de455aef85fcc552dafdd91e8a1$83213d35 ############################################################## # Dynamic script for expression md4(MD4($p).$s.md4($p)),debug ############################################################## Expression=dynamic=md4(MD4($p).$s.md4($p)) # Flags for this format Flag=MGF_FLAT_BUFFERS Flag=MGF_SALTED # Lengths used in this format SaltLen=-32 MaxInputLenX86=110 MaxInputLen=110 # The functions in the script Func=DynamicFunc__clean_input_kwik Func=DynamicFunc__LargeHash_OUTMode_base16u Func=DynamicFunc__append_keys Func=DynamicFunc__MD4_crypt_input1_overwrite_input2 Func=DynamicFunc__LargeHash_OUTMode_base16 Func=DynamicFunc__append_keys2 Func=DynamicFunc__MD4_crypt_input2_overwrite_input2 Func=DynamicFunc__clean_input_kwik Func=DynamicFunc__append_salt Func=DynamicFunc__append_input_from_input2 Func=DynamicFunc__MD4_crypt_input1_to_output1_FINAL # The test hashes that validate this script Test=@dynamic=md4(MD4($p).$s.md4($p))@ee42213df9cba9153d42c226f0daf9c2$719a288e:abc Test=@dynamic=md4(MD4($p).$s.md4($p))@7fb0bf5fe7ba047508b6fc03361f23d1$3d85c237:john Test=@dynamic=md4(MD4($p).$s.md4($p))@d691bcd654a62b3db1d9363726d85f60$7184f1d5:passweird Test=@dynamic=md4(MD4($p).$s.md4($p))@5b306463764d0e4cb43d8ef7d6879348$85b68792:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEF Test=@dynamic=md4(MD4($p).$s.md4($p))@b6c89de455aef85fcc552dafdd91e8a1$83213d35: $ ../run/john -test -form:'dynamic=md4(MD4($p).$s.md4($p))' Benchmarking: dynamic=md4(MD4($p).$s.md4($p)) [128/128 AVX 4x3]... FAILED (cmp_all(1)) ``` I'm not 100% sure the problem is in the new test vectors or an actual bug, but it looks like the latter.
Author
Owner

@jfoug commented on GitHub (Sep 11, 2015):

No, this is a known issue that I am working on, but have not completed yet. It is partly due to trying to go directly from a recursive descent parsed program and 'converting' it into a flat iterated program.

we do this MD4($p) putting that into buf 2.
then we append keys and do md4() overwriting the buf 2.
we then put salt into buf 1, append results of buf 2 and then do a final MD4

Well you can see that this is not what matches the expression. This type problem was found with the generic-dynamic-fuzzer, but I have not 'fixed' it yet.

This has nothing to do with upcase, low case. or length of buffers. It failed before any changes you made. simply the dyna-compiler not properly emitting code.

<!-- gh-comment-id:139649703 --> @jfoug commented on GitHub (Sep 11, 2015): No, this is a known issue that I am working on, but have not completed yet. It is partly due to trying to go directly from a recursive descent parsed program and 'converting' it into a flat iterated program. we do this MD4($p) putting that into buf 2. then we append keys and do md4() overwriting the buf 2. we then put salt into buf 1, append results of buf 2 and then do a final MD4 Well you can see that this is not what matches the expression. This type problem was found with the generic-dynamic-fuzzer, but I have not 'fixed' it yet. This has nothing to do with upcase, low case. or length of buffers. It failed before any changes you made. simply the dyna-compiler not properly emitting code.
Author
Owner

@kholia commented on GitHub (May 8, 2016):

The following dynamic expression is also failing,

$ ../run/john -format=dynamic='md5(sha1($p).md5($p).sha1($p))' hash
...
Self test failed (cmp_all(1))
$ cat hash
c756b56aed8d6748ee63e1e270c71a3f

Password for this hash is password. This hashing scheme is used in SunShop Shopping Cart.

<!-- gh-comment-id:217702077 --> @kholia commented on GitHub (May 8, 2016): The following dynamic expression is also failing, ``` $ ../run/john -format=dynamic='md5(sha1($p).md5($p).sha1($p))' hash ... Self test failed (cmp_all(1)) ``` ``` $ cat hash c756b56aed8d6748ee63e1e270c71a3f ``` Password for this hash is `password`. This hashing scheme is used in `SunShop Shopping Cart`.
Author
Owner

@kholia commented on GitHub (May 8, 2016):

$ ../run/john -format=dynamic='md5(sha1($p).md5($p).sha1($p)),debug' hash
...
Expression=dynamic=md5(sha1($p).md5($p).sha1($p))
#  Flags for this format
Flag=MGF_FLAT_BUFFERS
#  Lengths used in this format
MaxInputLenX86=110
MaxInputLen=110
#  The functions in the script
Func=DynamicFunc__clean_input_kwik
Func=DynamicFunc__append_keys
Func=DynamicFunc__SHA1_crypt_input1_overwrite_input2
Func=DynamicFunc__append_keys2
Func=DynamicFunc__MD5_crypt_input2_overwrite_input2
Func=DynamicFunc__clean_input_kwik
Func=DynamicFunc__append_keys
Func=DynamicFunc__SHA1_crypt_input1_overwrite_input2
Func=DynamicFunc__clean_input_kwik
Func=DynamicFunc__append_input_from_input2
Func=DynamicFunc__append_input_from_input2
Func=DynamicFunc__MD5_crypt_input1_to_output1_FINAL

It seems that the input2 buffer is being overwritten.

<!-- gh-comment-id:217702409 --> @kholia commented on GitHub (May 8, 2016): ``` $ ../run/john -format=dynamic='md5(sha1($p).md5($p).sha1($p)),debug' hash ... Expression=dynamic=md5(sha1($p).md5($p).sha1($p)) # Flags for this format Flag=MGF_FLAT_BUFFERS # Lengths used in this format MaxInputLenX86=110 MaxInputLen=110 # The functions in the script Func=DynamicFunc__clean_input_kwik Func=DynamicFunc__append_keys Func=DynamicFunc__SHA1_crypt_input1_overwrite_input2 Func=DynamicFunc__append_keys2 Func=DynamicFunc__MD5_crypt_input2_overwrite_input2 Func=DynamicFunc__clean_input_kwik Func=DynamicFunc__append_keys Func=DynamicFunc__SHA1_crypt_input1_overwrite_input2 Func=DynamicFunc__clean_input_kwik Func=DynamicFunc__append_input_from_input2 Func=DynamicFunc__append_input_from_input2 Func=DynamicFunc__MD5_crypt_input1_to_output1_FINAL ``` It seems that the `input2` buffer is being overwritten.
Author
Owner

@jfoug commented on GitHub (Dec 27, 2018):

Please test using the PR: #3568

<!-- gh-comment-id:450252556 --> @jfoug commented on GitHub (Dec 27, 2018): Please test using the PR: #3568
Author
Owner

@jfoug commented on GitHub (Dec 27, 2018):

@kholia:

After PR:

$ ../run/john -format=dynamic='md5(sha1($p).md5($p).sha1($p))' hash
cmp_one() failed. This format will FAIL and needs the Slower dyna-compiler format
This expression will use the RDP dynamic compiler format.
Using default input encoding: UTF-8
Loaded 1 password hash (dynamic=md5(sha1($p).md5($p).sha1($p)) [Dynamic RDP])
Warning: no OpenMP support for this hash type, consider --fork=2
Proceeding with single, rules:Wordlist
Press 'q' or Ctrl-C to abort, almost any other key for status
Almost done: Processing the remaining buffered candidate passwords, if any
Proceeding with wordlist:../run/password.lst, rules:Wordlist
password         (?)
1g 0:00:00:00 DONE 2/3 (2018-12-27 17:32) 18.86g/s 63396p/s 63396c/s 63396C/s 123456..Geronimo
Use the "--show --format=dynamic=md5(sha1($p).md5($p).sha1($p))" options to display all of the cracked passwords reliably
Session completed

$ cat hash
c756b56aed8d6748ee63e1e270c71a3f

$ cat ../run/john.pot
@dynamic=md5(sha1($p).md5($p).sha1($p))@c756b56aed8d6748ee63e1e270c71a3f:password

$ ../run/john -format=dynamic='md5(sha1($p).md5($p).sha1($p))' -show in
cmp_one() failed. This format will FAIL and needs the Slower dyna-compiler format
This expression will use the RDP dynamic compiler format.
?:password

1 password hash cracked, 0 left

Since this was 'supposed' RW data, so I wanted to test all aspects of it, including the .pot file.

<!-- gh-comment-id:450253641 --> @jfoug commented on GitHub (Dec 27, 2018): @kholia: After PR: ``` $ ../run/john -format=dynamic='md5(sha1($p).md5($p).sha1($p))' hash cmp_one() failed. This format will FAIL and needs the Slower dyna-compiler format This expression will use the RDP dynamic compiler format. Using default input encoding: UTF-8 Loaded 1 password hash (dynamic=md5(sha1($p).md5($p).sha1($p)) [Dynamic RDP]) Warning: no OpenMP support for this hash type, consider --fork=2 Proceeding with single, rules:Wordlist Press 'q' or Ctrl-C to abort, almost any other key for status Almost done: Processing the remaining buffered candidate passwords, if any Proceeding with wordlist:../run/password.lst, rules:Wordlist password (?) 1g 0:00:00:00 DONE 2/3 (2018-12-27 17:32) 18.86g/s 63396p/s 63396c/s 63396C/s 123456..Geronimo Use the "--show --format=dynamic=md5(sha1($p).md5($p).sha1($p))" options to display all of the cracked passwords reliably Session completed $ cat hash c756b56aed8d6748ee63e1e270c71a3f $ cat ../run/john.pot @dynamic=md5(sha1($p).md5($p).sha1($p))@c756b56aed8d6748ee63e1e270c71a3f:password $ ../run/john -format=dynamic='md5(sha1($p).md5($p).sha1($p))' -show in cmp_one() failed. This format will FAIL and needs the Slower dyna-compiler format This expression will use the RDP dynamic compiler format. ?:password 1 password hash cracked, 0 left ``` Since this was 'supposed' RW data, so I wanted to test all aspects of it, including the .pot file.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openwall/john#1154
No description provided.