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 out of bounds read in get_fat() #26

Closed
hannob opened this issue Apr 13, 2016 · 0 comments
Closed

heap out of bounds read in get_fat() #26

hannob opened this issue Apr 13, 2016 · 0 comments
Assignees

Comments

@hannob
Copy link

hannob commented Apr 13, 2016

An invalid memory read (heap oob) can happen with a malformed filesystem in the function get_fat().

This was found with american fuzzy lop and address sanitizer.

ASAN stack trace:

==17221==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61400000fdc8 at pc 0x0000004f5289 bp 0x7fff4589e890 sp 0x7fff4589e888
READ of size 4 at 0x61400000fdc8 thread T0
    #0 0x4f5288 in get_fat /mnt/ram/dosfstools/src/fat.c:68:19
    #1 0x4f5288 in read_fat /mnt/ram/dosfstools/src/fat.c:165
    #2 0x4e018c in main /mnt/ram/dosfstools/src/fsck.fat.c:187:12
    #3 0x7f140fa897af in __libc_start_main (/lib64/libc.so.6+0x207af)
    #4 0x4181e8 in _start (/mnt/ram/dosfstools/fsck.fat+0x4181e8)

0x61400000fdc8 is located 0 bytes to the right of 392-byte region [0x61400000fc40,0x61400000fdc8)
allocated by thread T0 here:
    #0 0x4b3888 in __interceptor_malloc (/mnt/ram/dosfstools/fsck.fat+0x4b3888)
    #1 0x4f332c in alloc /mnt/ram/dosfstools/src/common.c:66:17

SUMMARY: AddressSanitizer: heap-buffer-overflow /mnt/ram/dosfstools/src/fat.c:68:19 in get_fat
Shadow bytes around the buggy address:
  0x0c287fff9f60: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c287fff9f70: fd fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa
  0x0c287fff9f80: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c287fff9f90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c287fff9fa0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c287fff9fb0: 00 00 00 00 00 00 00 00 00[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 00 fa fa
  0x0c287fffa000: 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
  Left alloca redzone:     ca
  Right alloca redzone:    cb

dosfstools-get_fat-oob-heap-read.zip

@andreasbombe andreasbombe self-assigned this Apr 14, 2016
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

2 participants