dmg2img icon indicating copy to clipboard operation
dmg2img copied to clipboard

A Segmentation fault in dmg2img.c:284

Open seviezhou opened this issue 4 years ago • 1 comments

System info

Ubuntu X64, gcc (Ubuntu 5.5.0-12ubuntu1), dmg2img (latest master f16f24)

Command line

./dmg2img -i ./heap-overflow-dmg2img-284 -o /dev/null

Output

Segmentation fault

AddressSanitizer output

=================================================================
==45846==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61400000ffef at pc 0x7f6e5ebdc935 bp 0x7fff9c6bbd10 sp 0x7fff9c6bb4b8
READ of size 268435536 at 0x61400000ffef thread T0
    #0 0x7f6e5ebdc934 in __asan_memcpy (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x8c934)
    #1 0x40343a in memcpy /usr/include/x86_64-linux-gnu/bits/string3.h:53
    #2 0x40343a in main /home/seviezhou/dmg2img/dmg2img.c:284
    #3 0x7f6e5e37c83f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2083f)
    #4 0x407fe8 in _start (/home/seviezhou/dmg2img/dmg2img+0x407fe8)

0x61400000ffef is located 0 bytes to the right of 431-byte region [0x61400000fe40,0x61400000ffef)
allocated by thread T0 here:
    #0 0x7f6e5ebe8602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
    #1 0x403119 in main /home/seviezhou/dmg2img/dmg2img.c:265

SUMMARY: AddressSanitizer: heap-buffer-overflow ??:0 __asan_memcpy
Shadow bytes around the buggy address:
  0x0c287fff9fa0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c287fff9fb0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c287fff9fc0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c287fff9fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c287fff9fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c287fff9ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00[07]fa fa
  0x0c287fffa000: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c287fffa010: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c287fffa020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c287fffa030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c287fffa040: 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
==45846==ABORTING

POC

heap-overflow-dmg2img-284.zip

seviezhou avatar Aug 01 '20 13:08 seviezhou

This has CVE-2021-3548 assigned.

carnil avatar May 14 '21 04:05 carnil