Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heap Buffer Overflow in Function Storage::init #1

Open
grandnew opened this issue Aug 23, 2018 · 0 comments
Open

Heap Buffer Overflow in Function Storage::init #1

grandnew opened this issue Aug 23, 2018 · 0 comments

Comments

@grandnew
Copy link

I used g++ 5.4 and AddressSanitizer to build doc2txt, this file can cause heap buffer overflow in function Storage::init in Storage.cpp when executing this command(pic is just a folder which is used to store the picture in doc file):

./doc2txt ./heap-buffer-overflow_init.doc 1.txt ./pic/

This is the ASAN information:

=================================================================
==5702==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x62100001ca1c at pc 0x7f723d545bec bp 0x7fff6a6378f0 sp 0x7fff6a637098
WRITE of size 8760 at 0x62100001ca1c thread T0
    #0 0x7f723d545beb in __asan_memset (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x8cbeb)
    #1 0x404eb2 in memset /usr/include/x86_64-linux-gnu/bits/string3.h:90
    #2 0x404eb2 in Storage::init(_IO_FILE*) src/Storage.cpp:160
    #3 0x406a3e in parse_doc(char const*, char const*, char const*) src/parse_doc.cpp:20
    #4 0x4018b2 in main src/main.cpp:10
    #5 0x7f723cb7782f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #6 0x401c78 in _start (/home/fouzhe/my_fuzz/doc2txt/doc2txt+0x401c78)

0x62100001ca1c is located 0 bytes to the right of 4380-byte region [0x62100001b900,0x62100001ca1c)
allocated by thread T0 here:
    #0 0x7f723d551602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x404e46 in Storage::init(_IO_FILE*) src/Storage.cpp:156
    #2 0x7fff6a637b9f  (<unknown module>)

SUMMARY: AddressSanitizer: heap-buffer-overflow ??:0 __asan_memset
Shadow bytes around the buggy address:
  0x0c427fffb8f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c427fffb900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c427fffb910: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c427fffb920: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c427fffb930: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c427fffb940: 00 00 00[04]fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c427fffb950: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c427fffb960: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c427fffb970: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c427fffb980: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c427fffb990: 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
==5702==ABORTING
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant