mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #1158] --input-encoding: asan error #724
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#724
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 @loverszhaokai on GitHub (Mar 26, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1158
This bug is found by fuzzzing the options of John.
#1. Prepare
1.1 content of 7z_fmt
$7z$0$19$0$1122$8$d1f50227759415890000000000000000$1412385885$112$112$5e5b8b734adf52a64c541a5a5369023d7cccb78bd910c0092535dfb013a5df84ac692c5311d2e7bbdc580f5b867f7b5dd43830f7b4f37e41c7277e228fb92a6dd854a31646ad117654182253706dae0c069d3f4ce46121d52b6f20741a0bb39fc61113ce14d22f9184adafd6b5333fb1
1.2 compile with asan
$ export ASAN_OPTIONS='abort_on_error=1'
$ AFL_USE_ASAN=1 AFL_HARDEN=1 ./configure --enable-asan && make -sj8
#2. Reproduce
$ ./john 7z_fmt --input-encoding=CP720
Loaded 1 password hash (7z, 7-Zip [SHA256 AES 32/64])
Will run 8 OpenMP threads
Note: This format may emit false positives, so it will keep trying even after
finding a possible candidate.
==65339== ERROR: AddressSanitizer: global-buffer-overflow on address 0x00000094ecfb at pc 0x77ebcc bp 0x7fff5e96f110 sp 0x7fff5e96f108
READ of size 1 at 0x00000094ecfb thread T0
#0 0x77ebcb (/home/zhaokai/WorkSpace/open_wall/JohnTheRipper_test_options_asan/run/john+0x77ebcb)
#1 0x77f0fc (/home/zhaokai/WorkSpace/open_wall/JohnTheRipper_test_options_asan/run/john+0x77f0fc)
#2 0x781c75 (/home/zhaokai/WorkSpace/open_wall/JohnTheRipper_test_options_asan/run/john+0x781c75)
#3 0x789891 (/home/zhaokai/WorkSpace/open_wall/JohnTheRipper_test_options_asan/run/john+0x789891)
#4 0x78baa4 (/home/zhaokai/WorkSpace/open_wall/JohnTheRipper_test_options_asan/run/john+0x78baa4)
#5 0x7341f0 (/home/zhaokai/WorkSpace/open_wall/JohnTheRipper_test_options_asan/run/john+0x7341f0)
#6 0x73431c (/home/zhaokai/WorkSpace/open_wall/JohnTheRipper_test_options_asan/run/john+0x73431c)
#7 0x75a6f2 (/home/zhaokai/WorkSpace/open_wall/JohnTheRipper_test_options_asan/run/john+0x75a6f2)
#8 0x75b23e (/home/zhaokai/WorkSpace/open_wall/JohnTheRipper_test_options_asan/run/john+0x75b23e)
#9 0x7fcab8875ec4 (/lib/x86_64-linux-gnu/libc-2.19.so+0x21ec4)
#10 0x406632 (/home/zhaokai/WorkSpace/open_wall/JohnTheRipper_test_options_asan/run/john+0x406632)
0x00000094ecfb is located 37 bytes to the left of global variable '.LC38 (rules.c)' (0x94ed20) of size 163
0x00000094ecfb is located 0 bytes to the right of global variable '.LC37 (rules.c)' (0x94ece0) of size 27
'*.LC37 (rules.c)' is ascii string 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
Shadow bytes around the buggy address:
0x000080121d40: 05 f9 f9 f9 f9 f9 f9 f9 00 00 00 00 05 f9 f9 f9
0x000080121d50: f9 f9 f9 f9 00 00 00 00 00 00 00 00 00 00 00 00
0x000080121d60: 00 03 f9 f9 f9 f9 f9 f9 00 00 00 00 00 00 00 00
0x000080121d70: 00 00 00 00 00 03 f9 f9 f9 f9 f9 f9 00 00 00 00
0x000080121d80: 00 00 00 00 00 00 00 00 00 03 f9 f9 f9 f9 f9 f9
=>0x000080121d90: 00 00 00 00 07 f9 f9 f9 f9 f9 f9 f9 00 00 00[03]
0x000080121da0:f9 f9 f9 f9 00 00 00 00 00 00 00 00 00 00 00 00
0x000080121db0: 00 00 00 00 00 00 00 00 03 f9 f9 f9 f9 f9 f9 f9
0x000080121dc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x000080121dd0: 00 00 00 00 03 f9 f9 f9 f9 f9 f9 f9 00 00 00 00
0x000080121de0: 00 00 00 00 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 righ 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
ASan internal: fe
==65339== ABORTING
Aborted
$ asan_symbolize.py
#0 0x77ebcb in rules_init_conv /home/zhaokai/WorkSpace/open_wall/JohnTheRipper_test_options_asan/src/rules.c:804
pen_wall/JohnTheRipper_test_options_asan/run/john+0x406632)
#10 0x406632 in _start ??:?
@magnumripper commented on GitHub (Mar 26, 2015):
We could hide the bug using
while (*src && *dst)but even better would be to bail out with error. This function assumes that src and dst are of same length.@magnumripper commented on GitHub (Mar 26, 2015):
OK the real problem is this, in encoding_data.h
CHARS_LOWER and CHARS_UPPER are supposed to map exactly. In this case, all of CHARS_LOWER should have been placed in CHARS_LOW_ONLY since they have no upper-case mapping.
But encoding_data.h is auto-generated from the Unicode database - I need to look into the generator.
@magnumripper commented on GitHub (Mar 26, 2015):
OK the problem was that CP720 is not supported in Perl so that part of encoding_data.h was not auto generated - and the manual implementation was not correct.
Thank you for finding this bug!
@loverszhaokai commented on GitHub (Mar 26, 2015):
@magnumripper 👍