exif icon indicating copy to clipboard operation
exif copied to clipboard

heap-buffer-overflow

Open zjr-g opened this issue 2 years ago • 0 comments

enviroment: ubuntu22.04

requirement: compile with asan

command: exif poc -verbose

poc: crash 6

output:
system: little-endian
data: little-endian
=================================================================
==35507==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020000005d4 at pc 0x555f8b226fbf bp 0x7ffdad0269b0 sp 0x7ffdad0269a0
READ of size 4 at 0x6020000005d4 thread T0
    #0 0x555f8b226fbe in addTagNodeToIfd /home/zjr/python_fuzzer/exif/exif.c:1543
    #1 0x555f8b22f8f3 in parseIFD /home/zjr/python_fuzzer/exif/exif.c:2438
    #2 0x555f8b221b8c in createIfdTableArray /home/zjr/python_fuzzer/exif/exif.c:334
    #3 0x555f8b21f929 in main /home/zjr/python_fuzzer/exif/sample_main.c:63
    #4 0x7fe39ad6ad8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    #5 0x7fe39ad6ae3f in __libc_start_main_impl ../csu/libc-start.c:392
    #6 0x555f8b21f5e4 in _start (/usr/bin/exifsan+0x55e4)

0x6020000005d4 is located 0 bytes to the right of 4-byte region [0x6020000005d0,0x6020000005d4)
allocated by thread T0 here:
    #0 0x7fe39b01d887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x555f8b22f03a in parseIFD /home/zjr/python_fuzzer/exif/exif.c:2401
    #2 0x555f8b221b8c in createIfdTableArray /home/zjr/python_fuzzer/exif/exif.c:334
    #3 0x555f8b21f929 in main /home/zjr/python_fuzzer/exif/sample_main.c:63
    #4 0x7fe39ad6ad8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

SUMMARY: AddressSanitizer: heap-buffer-overflow /home/zjr/python_fuzzer/exif/exif.c:1543 in addTagNodeToIfd
Shadow bytes around the buggy address:
  0x0c047fff8060: fa fa 00 fa fa fa 04 fa fa fa 04 fa fa fa fd fa
  0x0c047fff8070: fa fa 03 fa fa fa 03 fa fa fa 04 fa fa fa 04 fa
  0x0c047fff8080: fa fa 04 fa fa fa 04 fa fa fa fd fa fa fa 00 fa
  0x0c047fff8090: fa fa 04 fa fa fa 04 fa fa fa 04 fa fa fa 04 fa
  0x0c047fff80a0: fa fa 04 fa fa fa 04 fa fa fa fd fa fa fa 00 fa
=>0x0c047fff80b0: fa fa 04 fa fa fa 04 fa fa fa[04]fa fa fa fa fa
  0x0c047fff80c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff80d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff80e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff80f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff8100: 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
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  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
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==35507==ABORTING

zjr-g avatar Jan 09 '24 05:01 zjr-g