[GH-ISSUE #1550] openssl_enc_fmt_plug.c:246 Asan global-buffer-overflow #1014

Closed
opened 2026-10-14 03:31:52 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @loverszhaokai on GitHub (Jul 13, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1550

#1. Reproduce

$ cat pwfile

$openssl$1$0$8$a1a5e529c8d92da5$88888888888888888888888888888888888888888888888de763bf61377d365243993137ad9729$1$0

$ ./configure --enable-asan && make -sj8
$ ./john pwfile

=================================================================
==17103==ERROR: AddressSanitizer: global-buffer-overflow on address 0x0000011f8c48 at pc 0x7e8f97 bp 0x7ffe0477a4f0 sp 0x7ffe0477a4e8
WRITE of size 1 at 0x0000011f8c48 thread T0
    #0 0x7e8f96 in get_salt /home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/src/openssl_enc_fmt_plug.c:246
    #1 0x950b51 in ldr_load_pw_line /home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/src/loader.c:916
    #2 0x94b503 in read_file /home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/src/loader.c:135
    #3 0x951e4e in ldr_load_pw_file /home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/src/loader.c:1019
    #4 0x94758c in john_load /home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/src/john.c:1023
    #5 0x948ceb in john_init /home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/src/john.c:1307
    #6 0x94a8b3 in main /home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/src/john.c:1748
    #7 0x7f7792fdeec4 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21ec4)
    #8 0x406de8 (/home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/run/john+0x406de8)

0x0000011f8c48 is located 56 bytes to the left of global variable 'saved_salt' from 'oracle11_fmt_plug.c' (0x11f8c80) of size 8
0x0000011f8c48 is located 0 bytes to the right of global variable 'cs' from 'openssl_enc_fmt_plug.c' (0x11f8a00) of size 584
SUMMARY: AddressSanitizer: global-buffer-overflow /home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/src/openssl_enc_fmt_plug.c:246 get_salt
Shadow bytes around the buggy address:
  0x000080237130: 00 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9
  0x000080237140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x000080237150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x000080237160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x000080237170: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x000080237180: 00 00 00 00 00 00 00 00 00[f9]f9 f9 f9 f9 f9 f9
  0x000080237190: 00 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9
  0x0000802371a0: 00 00 00 07 f9 f9 f9 f9 00 00 00 f9 f9 f9 f9 f9
  0x0000802371b0: 00 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9
  0x0000802371c0: 00 f9 f9 f9 f9 f9 f9 f9 00 00 00 00 00 04 f9 f9
  0x0000802371d0: f9 f9 f9 f9 00 00 00 00 00 00 00 00 00 00 00 00
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
  Contiguous container OOB:fc
  ASan internal:           fe
==17103==ABORTING
Aborted (core dumped)

#2. gdb Debug

Program received signal SIGABRT, Aborted.
0x00007ffff5790cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56  ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  0x00007ffff5790cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007ffff57940d8 in __GI_abort () at abort.c:89
#2  0x00007ffff6f640e9 in ?? () from /usr/lib/x86_64-linux-gnu/libasan.so.1
#3  0x00007ffff6f5bde5 in ?? () from /usr/lib/x86_64-linux-gnu/libasan.so.1
#4  0x00007ffff6f5fbe2 in ?? () from /usr/lib/x86_64-linux-gnu/libasan.so.1
#5  0x00007ffff6f5b279 in __asan_report_error () from /usr/lib/x86_64-linux-gnu/libasan.so.1
#6  0x00007ffff6f5c1b7 in __asan_report_store1 () from /usr/lib/x86_64-linux-gnu/libasan.so.1
#7  0x00000000007e8f97 in get_salt (ciphertext=0x7ffffffce690 "$openssl$1$0$8$a1a5e529c8d92da5$", '8' <repeats 47 times>, "de763bf61377d365243993137ad9729$1$0")
    at openssl_enc_fmt_plug.c:246
#8  0x0000000000950b52 in ldr_load_pw_line (db=0x1225e80 <database>,
    line=0x7ffffffce690 "$openssl$1$0$8$a1a5e529c8d92da5$", '8' <repeats 47 times>, "de763bf61377d365243993137ad9729$1$0") at loader.c:916
#9  0x000000000094b504 in read_file (db=0x1225e80 <database>, name=0x631000000868 "err_pwfiles/pwfile.openssl-enc", flags=2, process_line=0x94fd2d <ldr_load_pw_line>)
    at loader.c:135
#10 0x0000000000951e4f in ldr_load_pw_file (db=0x1225e80 <database>, name=0x631000000868 "err_pwfiles/pwfile.openssl-enc") at loader.c:1019
#11 0x000000000094758d in john_load () at john.c:1023
#12 0x0000000000948cec in john_init (name=0x7fffffffec2c "john", argc=2, argv=0x7fffffffe998) at john.c:1307
#13 0x000000000094a8b4 in main (argc=2, argv=0x7fffffffe998) at john.c:1748
(gdb)
Originally created by @loverszhaokai on GitHub (Jul 13, 2015). Original GitHub issue: https://github.com/openwall/john/issues/1550 #1. Reproduce $ cat pwfile ``` $openssl$1$0$8$a1a5e529c8d92da5$88888888888888888888888888888888888888888888888de763bf61377d365243993137ad9729$1$0 ``` $ ./configure --enable-asan && make -sj8 $ ./john pwfile ``` ================================================================= ==17103==ERROR: AddressSanitizer: global-buffer-overflow on address 0x0000011f8c48 at pc 0x7e8f97 bp 0x7ffe0477a4f0 sp 0x7ffe0477a4e8 WRITE of size 1 at 0x0000011f8c48 thread T0 #0 0x7e8f96 in get_salt /home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/src/openssl_enc_fmt_plug.c:246 #1 0x950b51 in ldr_load_pw_line /home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/src/loader.c:916 #2 0x94b503 in read_file /home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/src/loader.c:135 #3 0x951e4e in ldr_load_pw_file /home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/src/loader.c:1019 #4 0x94758c in john_load /home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/src/john.c:1023 #5 0x948ceb in john_init /home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/src/john.c:1307 #6 0x94a8b3 in main /home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/src/john.c:1748 #7 0x7f7792fdeec4 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21ec4) #8 0x406de8 (/home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/run/john+0x406de8) 0x0000011f8c48 is located 56 bytes to the left of global variable 'saved_salt' from 'oracle11_fmt_plug.c' (0x11f8c80) of size 8 0x0000011f8c48 is located 0 bytes to the right of global variable 'cs' from 'openssl_enc_fmt_plug.c' (0x11f8a00) of size 584 SUMMARY: AddressSanitizer: global-buffer-overflow /home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/src/openssl_enc_fmt_plug.c:246 get_salt Shadow bytes around the buggy address: 0x000080237130: 00 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9 0x000080237140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x000080237150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x000080237160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x000080237170: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x000080237180: 00 00 00 00 00 00 00 00 00[f9]f9 f9 f9 f9 f9 f9 0x000080237190: 00 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9 0x0000802371a0: 00 00 00 07 f9 f9 f9 f9 00 00 00 f9 f9 f9 f9 f9 0x0000802371b0: 00 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9 0x0000802371c0: 00 f9 f9 f9 f9 f9 f9 f9 00 00 00 00 00 04 f9 f9 0x0000802371d0: f9 f9 f9 f9 00 00 00 00 00 00 00 00 00 00 00 00 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 Contiguous container OOB:fc ASan internal: fe ==17103==ABORTING Aborted (core dumped) ``` #2. gdb Debug ``` C Program received signal SIGABRT, Aborted. 0x00007ffff5790cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 56 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) bt #0 0x00007ffff5790cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 #1 0x00007ffff57940d8 in __GI_abort () at abort.c:89 #2 0x00007ffff6f640e9 in ?? () from /usr/lib/x86_64-linux-gnu/libasan.so.1 #3 0x00007ffff6f5bde5 in ?? () from /usr/lib/x86_64-linux-gnu/libasan.so.1 #4 0x00007ffff6f5fbe2 in ?? () from /usr/lib/x86_64-linux-gnu/libasan.so.1 #5 0x00007ffff6f5b279 in __asan_report_error () from /usr/lib/x86_64-linux-gnu/libasan.so.1 #6 0x00007ffff6f5c1b7 in __asan_report_store1 () from /usr/lib/x86_64-linux-gnu/libasan.so.1 #7 0x00000000007e8f97 in get_salt (ciphertext=0x7ffffffce690 "$openssl$1$0$8$a1a5e529c8d92da5$", '8' <repeats 47 times>, "de763bf61377d365243993137ad9729$1$0") at openssl_enc_fmt_plug.c:246 #8 0x0000000000950b52 in ldr_load_pw_line (db=0x1225e80 <database>, line=0x7ffffffce690 "$openssl$1$0$8$a1a5e529c8d92da5$", '8' <repeats 47 times>, "de763bf61377d365243993137ad9729$1$0") at loader.c:916 #9 0x000000000094b504 in read_file (db=0x1225e80 <database>, name=0x631000000868 "err_pwfiles/pwfile.openssl-enc", flags=2, process_line=0x94fd2d <ldr_load_pw_line>) at loader.c:135 #10 0x0000000000951e4f in ldr_load_pw_file (db=0x1225e80 <database>, name=0x631000000868 "err_pwfiles/pwfile.openssl-enc") at loader.c:1019 #11 0x000000000094758d in john_load () at john.c:1023 #12 0x0000000000948cec in john_init (name=0x7fffffffec2c "john", argc=2, argv=0x7fffffffe998) at john.c:1307 #13 0x000000000094a8b4 in main (argc=2, argv=0x7fffffffe998) at john.c:1748 (gdb) ```
bsakaguchi 2026-10-14 03:31:52 +07:00
  • closed this issue
  • added the
    bug
    label
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#1014
No description provided.