[GH-ISSUE #1489] dynamic_39: ASan heap buffer overflow #961

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

Originally created by @frank-dittrich on GitHub (Jul 3, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1489

$ ./john --list=build-info 
Version: 1.8.0.6-jumbo-1-205-g6f2cf5c
Build: linux-gnu 64-bit AVX2-autoconf ASan
SIMD: AVX2, interleaving: MD4:3 MD5:3 SHA1:1 SHA256:1 SHA512:1

fail_dynamic_39.pw1:

$dynamic_39$ed9f940c3276afcc06d15babe8a1b61b$HEX$02020000ffff-0003002c01145267d48f000000000000000000020000ac100100ffffff000000000000000001ffff0001
$ ./john --skip-self-tests fail_dynamic_39.pw1
Warning: detected hash type "dynamic_39", but the string is also recognized as "net-md5"
Use the "--format=net-md5" option to force loading these as that type instead
Using default input encoding: UTF-8
Loaded 1 password hash (dynamic_39 [md5($s.pad16($p)) (net-md5) 256/256 AVX2 8x3])
Press 'q' or Ctrl-C to abort, almost any other key for status
=================================================================
==1742==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x63300001ac00 at pc 0x00000048ee34 bp 0x7ffd8219cbb0 sp 0x7ffd8219cba0
WRITE of size 1 at 0x63300001ac00 thread T0
    #0 0x48ee33 in __SSE_append_string_to_input /home/fd/git/JtR/src/dynamic_fmt.c:3222
    #1 0x4a6b56 in DynamicFunc__append_keys_pad16 /home/fd/git/JtR/src/dynamic_fmt.c:3765
    #2 0x4b8838 in crypt_all /home/fd/git/JtR/src/dynamic_fmt.c:1749
    #3 0x7390ef in crk_password_loop /home/fd/git/JtR/src/cracker.c:707
    #4 0x739efd in crk_salt_loop /home/fd/git/JtR/src/cracker.c:765
    #5 0x73a220 in crk_process_key /home/fd/git/JtR/src/cracker.c:813
    #6 0x7927ac in do_wordlist_crack /home/fd/git/JtR/src/wordlist.c:1240
    #7 0x724517 in do_wordlist_pass /home/fd/git/JtR/src/batch.c:38
    #8 0x7246d3 in do_batch_crack /home/fd/git/JtR/src/batch.c:58
    #9 0x74e4eb in john_run /home/fd/git/JtR/src/john.c:1479
    #10 0x74f079 in main /home/fd/git/JtR/src/john.c:1756
    #11 0x7fb7fc4c578f in __libc_start_main (/lib64/libc.so.6+0x2078f)
    #12 0x4065f8 in _start (/home/fd/git/JtR/run/john+0x4065f8)

0x63300001ac00 is located 0 bytes to the right of 107520-byte region [0x633000000800,0x63300001ac00)
allocated by thread T0 here:
    #0 0x7fb7fea52456 in posix_memalign (/lib64/libasan.so.2+0x99456)
    #1 0x773cba in mem_alloc_align_func /home/fd/git/JtR/src/memory.c:245
    #2 0x773d56 in mem_calloc_align_func /home/fd/git/JtR/src/memory.c:293
    #3 0x49dd63 in init /home/fd/git/JtR/src/dynamic_fmt.c:747
    #4 0x73d3b3 in fmt_init /home/fd/git/JtR/src/formats.c:62
    #5 0x752bdc in ldr_split_line /home/fd/git/JtR/src/loader.c:712
    #6 0x753708 in ldr_load_pw_line /home/fd/git/JtR/src/loader.c:802
    #7 0x754efe in read_file /home/fd/git/JtR/src/loader.c:135
    #8 0x757f4a in ldr_load_pw_file /home/fd/git/JtR/src/loader.c:1000
    #9 0x74b83c in john_load /home/fd/git/JtR/src/john.c:1021
    #10 0x74d355 in john_init /home/fd/git/JtR/src/john.c:1305
    #11 0x74ef57 in main /home/fd/git/JtR/src/john.c:1743
    #12 0x7fb7fc4c578f in __libc_start_main (/lib64/libc.so.6+0x2078f)

SUMMARY: AddressSanitizer: heap-buffer-overflow /home/fd/git/JtR/src/dynamic_fmt.c:3222 __SSE_append_string_to_input
Shadow bytes around the buggy address:
  0x0c667fffb530: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c667fffb540: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c667fffb550: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c667fffb560: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c667fffb570: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c667fffb580:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c667fffb590: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c667fffb5a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c667fffb5b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c667fffb5c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c667fffb5d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Heap right redzone:      fb
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack partial redzone:   f4
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
==1742==ABORTING

without --skip-self-tests, the self test fails:

$ ./johnfail_dynamic_39.pw1
Warning: detected hash type "dynamic_39", but the string is also recognized as "net-md5"
Use the "--format=net-md5" option to force loading these as that type instead
Using default input encoding: UTF-8
Loaded 1 password hash (dynamic_39 [md5($s.pad16($p)) (net-md5) 256/256 AVX2 8x3])
Self test failed (cmp_all(1))
Originally created by @frank-dittrich on GitHub (Jul 3, 2015). Original GitHub issue: https://github.com/openwall/john/issues/1489 ``` $ ./john --list=build-info Version: 1.8.0.6-jumbo-1-205-g6f2cf5c Build: linux-gnu 64-bit AVX2-autoconf ASan SIMD: AVX2, interleaving: MD4:3 MD5:3 SHA1:1 SHA256:1 SHA512:1 ``` fail_dynamic_39.pw1: ``` $dynamic_39$ed9f940c3276afcc06d15babe8a1b61b$HEX$02020000ffff-0003002c01145267d48f000000000000000000020000ac100100ffffff000000000000000001ffff0001 ``` ``` $ ./john --skip-self-tests fail_dynamic_39.pw1 Warning: detected hash type "dynamic_39", but the string is also recognized as "net-md5" Use the "--format=net-md5" option to force loading these as that type instead Using default input encoding: UTF-8 Loaded 1 password hash (dynamic_39 [md5($s.pad16($p)) (net-md5) 256/256 AVX2 8x3]) Press 'q' or Ctrl-C to abort, almost any other key for status ================================================================= ==1742==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x63300001ac00 at pc 0x00000048ee34 bp 0x7ffd8219cbb0 sp 0x7ffd8219cba0 WRITE of size 1 at 0x63300001ac00 thread T0 #0 0x48ee33 in __SSE_append_string_to_input /home/fd/git/JtR/src/dynamic_fmt.c:3222 #1 0x4a6b56 in DynamicFunc__append_keys_pad16 /home/fd/git/JtR/src/dynamic_fmt.c:3765 #2 0x4b8838 in crypt_all /home/fd/git/JtR/src/dynamic_fmt.c:1749 #3 0x7390ef in crk_password_loop /home/fd/git/JtR/src/cracker.c:707 #4 0x739efd in crk_salt_loop /home/fd/git/JtR/src/cracker.c:765 #5 0x73a220 in crk_process_key /home/fd/git/JtR/src/cracker.c:813 #6 0x7927ac in do_wordlist_crack /home/fd/git/JtR/src/wordlist.c:1240 #7 0x724517 in do_wordlist_pass /home/fd/git/JtR/src/batch.c:38 #8 0x7246d3 in do_batch_crack /home/fd/git/JtR/src/batch.c:58 #9 0x74e4eb in john_run /home/fd/git/JtR/src/john.c:1479 #10 0x74f079 in main /home/fd/git/JtR/src/john.c:1756 #11 0x7fb7fc4c578f in __libc_start_main (/lib64/libc.so.6+0x2078f) #12 0x4065f8 in _start (/home/fd/git/JtR/run/john+0x4065f8) 0x63300001ac00 is located 0 bytes to the right of 107520-byte region [0x633000000800,0x63300001ac00) allocated by thread T0 here: #0 0x7fb7fea52456 in posix_memalign (/lib64/libasan.so.2+0x99456) #1 0x773cba in mem_alloc_align_func /home/fd/git/JtR/src/memory.c:245 #2 0x773d56 in mem_calloc_align_func /home/fd/git/JtR/src/memory.c:293 #3 0x49dd63 in init /home/fd/git/JtR/src/dynamic_fmt.c:747 #4 0x73d3b3 in fmt_init /home/fd/git/JtR/src/formats.c:62 #5 0x752bdc in ldr_split_line /home/fd/git/JtR/src/loader.c:712 #6 0x753708 in ldr_load_pw_line /home/fd/git/JtR/src/loader.c:802 #7 0x754efe in read_file /home/fd/git/JtR/src/loader.c:135 #8 0x757f4a in ldr_load_pw_file /home/fd/git/JtR/src/loader.c:1000 #9 0x74b83c in john_load /home/fd/git/JtR/src/john.c:1021 #10 0x74d355 in john_init /home/fd/git/JtR/src/john.c:1305 #11 0x74ef57 in main /home/fd/git/JtR/src/john.c:1743 #12 0x7fb7fc4c578f in __libc_start_main (/lib64/libc.so.6+0x2078f) SUMMARY: AddressSanitizer: heap-buffer-overflow /home/fd/git/JtR/src/dynamic_fmt.c:3222 __SSE_append_string_to_input Shadow bytes around the buggy address: 0x0c667fffb530: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c667fffb540: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c667fffb550: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c667fffb560: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c667fffb570: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c667fffb580:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c667fffb590: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c667fffb5a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c667fffb5b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c667fffb5c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c667fffb5d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Heap right redzone: fb Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack partial redzone: f4 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe ==1742==ABORTING ``` without `--skip-self-tests`, the self test fails: ``` $ ./johnfail_dynamic_39.pw1 Warning: detected hash type "dynamic_39", but the string is also recognized as "net-md5" Use the "--format=net-md5" option to force loading these as that type instead Using default input encoding: UTF-8 Loaded 1 password hash (dynamic_39 [md5($s.pad16($p)) (net-md5) 256/256 AVX2 8x3]) Self test failed (cmp_all(1)) ```
bsakaguchi 2026-10-14 03:30:01 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@jfoug commented on GitHub (Jul 5, 2015):

@frank-dittrich Please try after ce54926 This should also fix the self-test failure.

I am not closing until you test. I 'think' I was getting failures before, but I may have fixed it elsewhere.

<!-- gh-comment-id:118570351 --> @jfoug commented on GitHub (Jul 5, 2015): @frank-dittrich Please try after ce54926 This should also fix the self-test failure. I am not closing until you test. I 'think' I was getting failures before, but I may have fixed it elsewhere.
Author
Owner

@frank-dittrich commented on GitHub (Jul 5, 2015):

This one is gone with latest bleeding-jumbo.

<!-- gh-comment-id:118615119 --> @frank-dittrich commented on GitHub (Jul 5, 2015): This one is gone with latest bleeding-jumbo.
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#961
No description provided.