[GH-ISSUE #1401] malloc.c: Assertion failed [2] #892

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

Originally created by @loverszhaokai on GitHub (Jun 7, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1401

This bug is found by afl.

This problem seems like https://github.com/magnumripper/JohnTheRipper/issues/1392, but the gdb backtrace is different, so they are maybe different bug.
#1. Reproduce

$ ./configure && make -sj8
$ cat pwfile

$openssl$1$0$8$a1a5e529c8X92da5$5243993<37ad9729$1$0
$openssl$1$1$8$844527fb2f5d7ad5$ebc978ea$1$0
$o�enssl$0$0$8$305cedc2a0521011$c7dbecf49a1dd0378e938bb9d3bf1$0
$openssl$0bf11609a01e78ec3f50f0cc483e636f9$7$1$56
$opens�l$0$0$8$3993671b�477e8f0$95384d6:d28c5cc4297ce37aea91064e$0$256$9bbbc2af?49214444370e3b3db6f4077a5b83c099a9b0a13d0c03dbcU9105aad078266470bb15c44e7b35aef66f456ba7f44fb0f60824331f5b598347cd471c6745374c7dbecf49a�d0378e938bb9d3d68703e3038805fb3c7bhmac-sha512$e9375b10853aa7c>9dZ086b82a97dd9ddd351ee0facde9bc3529742f0ffab990db046f5a64765d7a4b1c83b0290ae3eaa09278933cddcf1fed0ab14d408cd43fb73�8302f4b542c10869�b90e82f912c4a�4d�d002dce975c2bb308aad933bfcfd8375d91837048d110f007dc7ba884ccece94698b46d68d28c5ccLr9'ce37aea91064e$0
$openssl$0$0$�93671be477e8f0$9t7HSIXw3.QP7.R7dc7ba�84cce1064e$0$256$9bbbc2af6�R3$7444370 b3db6f40771$0
$o�enssl$0a5b83c099a9b0a13d0c03dbc891bfcfd8375d9180bb15c44e7b5aef66f456ba7f44fb0f60824331f5b598347cd471#67@4c7dbecf49a1dd0378e938bb9d3d68703e3038805fb3c7bf0623222bcc8e9375b1ee8e1edd435cdd086b89180bb15c44e7b3e0facde9bc3529742f0ff�������������������������ab990db046f5a64openssl 0bf11609a01e78ec3f50f765d7a4b1c83b0290acab3eaa09278933cddcf1fed0ab14d408cd43f73d830237dcd681425cd878bf4b542c1086f9$1$1$56
$openssl$94b90e82f91Cc4aa4de02bd002dce975cb�����bdb63bfcfd8375d91837048d110f007ba3852dbb498a5459538Tad4fb11d737dc7ba884ccece94698b46d68d28c5cc4297ce37ae91064e$1$0000

$ ./john pwfile

Warning: invalid UTF-8 seen reading out/crashes/id:000047,sig:06,src:000052,op:havoc,rep:64
Using default input encoding: UTF-8
Will run 8 OpenMP threads
Note: This format may emit false positives, so it will keep trying even after
finding a possible candidate.
Press 'q' or Ctrl-C to abort, almost any other key for status
Loaded 1 password hash (openssl-enc, OpenSSL "enc" encryption [32/64])
samson           (?)
benjamin         (?)
friday           (?)
Family           (?)
fireman          (?)
oranges          (?)
redrum           (?)
sundance         (?)
strong           (?)
....
Madisoning       (?)
Controling       (?)
Dianing          (?)
Nissaning        (?)
Ashtoning        (?)
Texasing         (?)
Grampsing        (?)
Modeming         (?)
Strating         (?)
john: malloc.c:2372: sysmalloc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 *(sizeof(size_t))) - 1)) & ~((2 *(sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long) old_end & pagemask) == 0)' failed.
Aborted

#2. GDB debug

Program terminated with signal SIGABRT, Aborted.
#0  0x00007fe389e97cc9 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  0x00007fe389e97cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00007fe389e9b0d8 in __GI_abort () at abort.c:89
#2  0x00007fe389ede7fd in __malloc_assert (
    assertion=assertion@entry=0x7fe389fe3060 "(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offs"..., file=file@entry=0x7fe389fdeb80 "malloc.c", line=line@entry=2372,
    function=function@entry=0x7fe389fdeefe <__func__.11292> "sysmalloc") at malloc.c:293
#3  0x00007fe389ee1c68 in sysmalloc (av=0x7fe38a21f760 <main_arena>, nb=65552) at malloc.c:2369
#4  _int_malloc (av=0x7fe38a21f760 <main_arena>, bytes=65536) at malloc.c:3800
#5  0x00007fe389ee37b0 in __GI___libc_malloc (bytes=65536) at malloc.c:2891
#6  0x00000000005d825e in mem_alloc_func (size=size@entry=65536) at memory.c:89
#7  0x00000000005c57d0 in do_incremental_crack (db=0xfac1c0 <database>, mode=<optimized out>) at inc.c:655
#8  0x00000000005cae51 in john_run () at john.c:1464
#9  0x00000000005cb52f in main (argc=2, argv=0x7ffd81fc1618) at john.c:1743
Originally created by @loverszhaokai on GitHub (Jun 7, 2015). Original GitHub issue: https://github.com/openwall/john/issues/1401 This bug is found by afl. This problem seems like https://github.com/magnumripper/JohnTheRipper/issues/1392, but the **gdb backtrace** is different, so they are maybe different bug. #1. Reproduce $ ./configure && make -sj8 $ cat pwfile ``` $openssl$1$0$8$a1a5e529c8X92da5$5243993<37ad9729$1$0 $openssl$1$1$8$844527fb2f5d7ad5$ebc978ea$1$0 $o�enssl$0$0$8$305cedc2a0521011$c7dbecf49a1dd0378e938bb9d3bf1$0 $openssl$0bf11609a01e78ec3f50f0cc483e636f9$7$1$56 $opens�l$0$0$8$3993671b�477e8f0$95384d6:d28c5cc4297ce37aea91064e$0$256$9bbbc2af?49214444370e3b3db6f4077a5b83c099a9b0a13d0c03dbcU9105aad078266470bb15c44e7b35aef66f456ba7f44fb0f60824331f5b598347cd471c6745374c7dbecf49a�d0378e938bb9d3d68703e3038805fb3c7bhmac-sha512$e9375b10853aa7c>9dZ086b82a97dd9ddd351ee0facde9bc3529742f0ffab990db046f5a64765d7a4b1c83b0290ae3eaa09278933cddcf1fed0ab14d408cd43fb73�8302f4b542c10869�b90e82f912c4a�4d�d002dce975c2bb308aad933bfcfd8375d91837048d110f007dc7ba884ccece94698b46d68d28c5ccLr9'ce37aea91064e$0 $openssl$0$0$�93671be477e8f0$9t7HSIXw3.QP7.R7dc7ba�84cce1064e$0$256$9bbbc2af6�R3$7444370 b3db6f40771$0 $o�enssl$0a5b83c099a9b0a13d0c03dbc891bfcfd8375d9180bb15c44e7b5aef66f456ba7f44fb0f60824331f5b598347cd471#67@4c7dbecf49a1dd0378e938bb9d3d68703e3038805fb3c7bf0623222bcc8e9375b1ee8e1edd435cdd086b89180bb15c44e7b3e0facde9bc3529742f0ff�������������������������ab990db046f5a64openssl 0bf11609a01e78ec3f50f765d7a4b1c83b0290acab3eaa09278933cddcf1fed0ab14d408cd43f73d830237dcd681425cd878bf4b542c1086f9$1$1$56 $openssl$94b90e82f91Cc4aa4de02bd002dce975cb�����bdb63bfcfd8375d91837048d110f007ba3852dbb498a5459538Tad4fb11d737dc7ba884ccece94698b46d68d28c5cc4297ce37ae91064e$1$0000 ``` $ ./john pwfile ``` C Warning: invalid UTF-8 seen reading out/crashes/id:000047,sig:06,src:000052,op:havoc,rep:64 Using default input encoding: UTF-8 Will run 8 OpenMP threads Note: This format may emit false positives, so it will keep trying even after finding a possible candidate. Press 'q' or Ctrl-C to abort, almost any other key for status Loaded 1 password hash (openssl-enc, OpenSSL "enc" encryption [32/64]) samson (?) benjamin (?) friday (?) Family (?) fireman (?) oranges (?) redrum (?) sundance (?) strong (?) .... Madisoning (?) Controling (?) Dianing (?) Nissaning (?) Ashtoning (?) Texasing (?) Grampsing (?) Modeming (?) Strating (?) john: malloc.c:2372: sysmalloc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 *(sizeof(size_t))) - 1)) & ~((2 *(sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long) old_end & pagemask) == 0)' failed. Aborted ``` #2. GDB debug ``` C Program terminated with signal SIGABRT, Aborted. #0 0x00007fe389e97cc9 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 0x00007fe389e97cc9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 #1 0x00007fe389e9b0d8 in __GI_abort () at abort.c:89 #2 0x00007fe389ede7fd in __malloc_assert ( assertion=assertion@entry=0x7fe389fe3060 "(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offs"..., file=file@entry=0x7fe389fdeb80 "malloc.c", line=line@entry=2372, function=function@entry=0x7fe389fdeefe <__func__.11292> "sysmalloc") at malloc.c:293 #3 0x00007fe389ee1c68 in sysmalloc (av=0x7fe38a21f760 <main_arena>, nb=65552) at malloc.c:2369 #4 _int_malloc (av=0x7fe38a21f760 <main_arena>, bytes=65536) at malloc.c:3800 #5 0x00007fe389ee37b0 in __GI___libc_malloc (bytes=65536) at malloc.c:2891 #6 0x00000000005d825e in mem_alloc_func (size=size@entry=65536) at memory.c:89 #7 0x00000000005c57d0 in do_incremental_crack (db=0xfac1c0 <database>, mode=<optimized out>) at inc.c:655 #8 0x00000000005cae51 in john_run () at john.c:1464 #9 0x00000000005cb52f in main (argc=2, argv=0x7ffd81fc1618) at john.c:1743 ```
Author
Owner

@jfoug commented on GitHub (Jun 23, 2015):

I can not replicate this problem. It appears that it happens right when john switches to incremental mode. I see the same candidates, BUT where you crash, I get

Dianing          (?)
Nissaning        (?)
Ashtoning        (?)
Texasing         (?)
Grampsing        (?)
Modeming         (?)
Strating         (?)
121288           (?)
molla            (?)
miler1           (?)
mania            (?)
aries            (?)
shomes           (?)
stack1           (?)
socker           (?)
sonier           (?)
astar            (?)
011287           (?)
090505           (?)

121288 is the first found in incremental. I have tested on cygwin64, Ubuntu-64 and Fedora-64, and even a Mingw-64 build cross built on fedora running under wine. All builds were happy.

<!-- gh-comment-id:114505272 --> @jfoug commented on GitHub (Jun 23, 2015): I can not replicate this problem. It appears that it happens right when john switches to incremental mode. I see the same candidates, BUT where you crash, I get ``` Dianing (?) Nissaning (?) Ashtoning (?) Texasing (?) Grampsing (?) Modeming (?) Strating (?) 121288 (?) molla (?) miler1 (?) mania (?) aries (?) shomes (?) stack1 (?) socker (?) sonier (?) astar (?) 011287 (?) 090505 (?) ``` 121288 is the first found in incremental. I have tested on cygwin64, Ubuntu-64 and Fedora-64, and even a Mingw-64 build cross built on fedora running under wine. All builds were happy.
Author
Owner

@loverszhaokai commented on GitHub (Jun 24, 2015):

@jfoug After retest, I think this bug has been fixed. Thanks.

<!-- gh-comment-id:114687313 --> @loverszhaokai commented on GitHub (Jun 24, 2015): @jfoug After retest, I think this bug has been fixed. Thanks.
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#892
No description provided.