[GH-ISSUE #1360] External mode: asan error heap buffer overflow #858

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

Originally created by @loverszhaokai on GitHub (May 27, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1360

Originally assigned to: @loverszhaokai on GitHub.

#1. Analysis

This bug is similar to https://github.com/magnumripper/JohnTheRipper/issues/1358. But this bug is heap buffer overflow, maybe they are different bugs or same bugs.
#2. Reproduce

$ ./configure --enable-asan && make -sj8
$ cat test_pw

$apr1$a2Jqm...$grFrwEgiQleDr0zR4Jx1b.

$ cat local.conf

[List.External:Lanman]
int numbers[10];
int lowers[26];
int uppers[26];
int symbols[32];
int boundaries_charclass[4];
int boundaries_numbers[10];
int boundaries_letters[26];
int boundaries_symbols[32];
int seed;
int password_length;
void init()
{
    password_length = 16; /* Change this to match config */

    int c, i;

    c = '0'; i = 0; while (c <= '9') numbers[i++] = c++;
    c = 'a'; i = 0; while (c <= 'z') lowers[i++] = c++;
    c = 'A'; i = 0; while (c <= 'Z') uppers[i++] = c++;

    /* Symbols */
    i = 0;
    symbols[i++] = '!'; symbols[i++] = '@'; symbols[i++] = '#'; symbols[i++] = '$';
    symbols[i++] = '%'; symbols[i++] = '^'; symbols[i++] = '&'; symbols[i++] = '*';
    symbols[i++] = '('; symbols[i++] = ')'; symbols[i++] = '~'; symbols[i++] = '-';
    symbols[i++] = '_'; symbols[i++] = '='; symbols[i++] = '+'; symbols[i++] = '\\';
    symbols[i++] = '|'; symbols[i++] = '/'; symbols[i++] = '['; symbols[i++] = ']';
    symbols[i++] = '{'; symbols[i++] = '}'; symbols[i++] = ';'; symbols[i++] = ':';
    symbols[i++] = '`'; symbols[i++] = '\''; symbols[i++] = '"'; symbols[i++] = ',';
    symbols[i++] = '.'; symbols[i++] = '<'; symbols[i++] = '>'; symbols[i++] = '?';

    i = 0;
    boundaries_charclass[i++] = 536870912; boundaries_charclass[i++] = 1073741824;
    boundaries_charclass[i++] = 1610612736; boundaries_charclass[i++] = 2147483647;

    i = 0;
    boundaries_numbers[i++] = 214748365; boundaries_numbers[i++] = 429496730;
    boundaries_numbers[i++] = 644245095; boundaries_numbers[i++] = 858993460;
    boundaries_numbers[i++] = 1073741824; boundaries_numbers[i++] = 1288490189;
    boundaries_numbers[i++] = 1503238554; boundaries_numbers[i++] = 1717986919;
    boundaries_numbers[i++] = 193273=284; boundaries_numbers[i++] = 2147483647;

}

void generate()
{
}


void restore()
{
}

$ ../john test_pw --format=md5crypt --external=lanman --config=local.conf

=================================================================
==108368==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x617000010278 at pc 0x72749d bp 0x7ffe82c1dcd0 sp 0x7ffe82c1dcc8
READ of size 4 at 0x617000010278 thread T0
    #0 0x72749c in c_execute_fast /home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/src/compiler.c:1107
    #1 0x72f5d9 in ext_init /home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/src/external.c:190
    #2 0x73f024 in john_load /home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/src/john.c:922
    #3 0x741149 in john_init /home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/src/john.c:1280
    #4 0x742ca5 in main /home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/src/john.c:1707
    #5 0x7f93bf65dec4 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21ec4)
    #6 0x406c72 (/home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/run/john+0x406c72)

AddressSanitizer can not describe address in more detail (wild memory access suspected).
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/src/compiler.c:1107 c_execute_fast
Shadow bytes around the buggy address:
  0x0c2e7fff9ff0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2e7fffa000: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2e7fffa010: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2e7fffa020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2e7fffa030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c2e7fffa040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa[fa]
  0x0c2e7fffa050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2e7fffa060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2e7fffa070: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2e7fffa080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2e7fffa090: 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
  Contiguous container OOB:fc
  ASan internal:           fe
==108368==ABORTING
Aborted
Originally created by @loverszhaokai on GitHub (May 27, 2015). Original GitHub issue: https://github.com/openwall/john/issues/1360 Originally assigned to: @loverszhaokai on GitHub. #1. Analysis This bug is similar to https://github.com/magnumripper/JohnTheRipper/issues/1358. But this bug is heap buffer overflow, maybe they are different bugs or same bugs. #2. Reproduce $ ./configure --enable-asan && make -sj8 $ cat test_pw ``` $apr1$a2Jqm...$grFrwEgiQleDr0zR4Jx1b. ``` $ cat local.conf ``` C [List.External:Lanman] int numbers[10]; int lowers[26]; int uppers[26]; int symbols[32]; int boundaries_charclass[4]; int boundaries_numbers[10]; int boundaries_letters[26]; int boundaries_symbols[32]; int seed; int password_length; void init() { password_length = 16; /* Change this to match config */ int c, i; c = '0'; i = 0; while (c <= '9') numbers[i++] = c++; c = 'a'; i = 0; while (c <= 'z') lowers[i++] = c++; c = 'A'; i = 0; while (c <= 'Z') uppers[i++] = c++; /* Symbols */ i = 0; symbols[i++] = '!'; symbols[i++] = '@'; symbols[i++] = '#'; symbols[i++] = '$'; symbols[i++] = '%'; symbols[i++] = '^'; symbols[i++] = '&'; symbols[i++] = '*'; symbols[i++] = '('; symbols[i++] = ')'; symbols[i++] = '~'; symbols[i++] = '-'; symbols[i++] = '_'; symbols[i++] = '='; symbols[i++] = '+'; symbols[i++] = '\\'; symbols[i++] = '|'; symbols[i++] = '/'; symbols[i++] = '['; symbols[i++] = ']'; symbols[i++] = '{'; symbols[i++] = '}'; symbols[i++] = ';'; symbols[i++] = ':'; symbols[i++] = '`'; symbols[i++] = '\''; symbols[i++] = '"'; symbols[i++] = ','; symbols[i++] = '.'; symbols[i++] = '<'; symbols[i++] = '>'; symbols[i++] = '?'; i = 0; boundaries_charclass[i++] = 536870912; boundaries_charclass[i++] = 1073741824; boundaries_charclass[i++] = 1610612736; boundaries_charclass[i++] = 2147483647; i = 0; boundaries_numbers[i++] = 214748365; boundaries_numbers[i++] = 429496730; boundaries_numbers[i++] = 644245095; boundaries_numbers[i++] = 858993460; boundaries_numbers[i++] = 1073741824; boundaries_numbers[i++] = 1288490189; boundaries_numbers[i++] = 1503238554; boundaries_numbers[i++] = 1717986919; boundaries_numbers[i++] = 193273=284; boundaries_numbers[i++] = 2147483647; } void generate() { } void restore() { } ``` $ ../john test_pw --format=md5crypt --external=lanman --config=local.conf ``` C ================================================================= ==108368==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x617000010278 at pc 0x72749d bp 0x7ffe82c1dcd0 sp 0x7ffe82c1dcc8 READ of size 4 at 0x617000010278 thread T0 #0 0x72749c in c_execute_fast /home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/src/compiler.c:1107 #1 0x72f5d9 in ext_init /home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/src/external.c:190 #2 0x73f024 in john_load /home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/src/john.c:922 #3 0x741149 in john_init /home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/src/john.c:1280 #4 0x742ca5 in main /home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/src/john.c:1707 #5 0x7f93bf65dec4 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21ec4) #6 0x406c72 (/home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/run/john+0x406c72) AddressSanitizer can not describe address in more detail (wild memory access suspected). SUMMARY: AddressSanitizer: heap-buffer-overflow /home/zhaokai/WorkSpace/open_wall/JohnTheRipper_kai/src/compiler.c:1107 c_execute_fast Shadow bytes around the buggy address: 0x0c2e7fff9ff0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2e7fffa000: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2e7fffa010: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2e7fffa020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2e7fffa030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa =>0x0c2e7fffa040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa[fa] 0x0c2e7fffa050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2e7fffa060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2e7fffa070: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2e7fffa080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2e7fffa090: 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 Contiguous container OOB:fc ASan internal: fe ==108368==ABORTING Aborted ```
bsakaguchi 2026-10-14 03:26:07 +07:00
Author
Owner

@magnumripper commented on GitHub (Nov 9, 2015):

http://www.openwall.com/lists/john-dev/2015/05/27/4

<!-- gh-comment-id:154888146 --> @magnumripper commented on GitHub (Nov 9, 2015): http://www.openwall.com/lists/john-dev/2015/05/27/4
Author
Owner

@magnumripper commented on GitHub (Nov 9, 2015):

http://www.openwall.com/lists/john-dev/2015/05/30/12

<!-- gh-comment-id:154888436 --> @magnumripper commented on GitHub (Nov 9, 2015): http://www.openwall.com/lists/john-dev/2015/05/30/12
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#858
No description provided.