AgentD / squashfs-tools-ng

A new set of tools and libraries for working with SquashFS images
Other
194 stars 30 forks source link

Heap Buffer Overflow from fuzzing #14

Closed Dr-Emann closed 4 years ago

Dr-Emann commented 4 years ago

This one looks a bit different from the others in #13, so adding it as a separate issue. See #13 for info about compilation and environment.

Base64:

aHNxcwIAAADOhl5dABAAAAEAAAABAAwAywECAAQAAAAgAAAAAAAAAAIBAAAAAAAA+gAAAAAAAAD/
/////////2MAAAAAAAAApQAAAAAAAADOAEAAAAAAAOgAAAAAAAAAaGkKQIAJALQBAAABANQMXl0B
AAAdAAAAAAAAAP///90AAGgAAAEA/QEAAAEA1AxeXQIAAAAAAAAAAgAA//8AAAADAAAAFYAAAAAA
AAAAAAEAAAAAAAAAAgAAAGEQgGAAAAAAAAAAAwAAAQAAAAC8AAAAAAAaABCAAAAgAAAAAB8gAAAA
AAAAANYAAAAAAAAACIDpAwAA6wMAAPAAAAAAAAAA

ASAN:

=================================================================
==32435==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xf4d038bc at pc 0x0815f65a bp 0xff956458 sp 0xff956450
READ of size 4 at 0xf4d038bc thread T0
    #0 0x815f659 in copy_block_sizes /home/dremann/Development/squashfs-tools-ng/lib/sqfs/tree_node_from_inode.c:66:36
    #1 0x815f659 in tree_node_from_inode /home/dremann/Development/squashfs-tools-ng/lib/sqfs/tree_node_from_inode.c:141
    #2 0x815199d in fill_dir /home/dremann/Development/squashfs-tools-ng/lib/sqfs/deserialize_fstree.c:133:8
    #3 0x8150a07 in deserialize_fstree /home/dremann/Development/squashfs-tools-ng/lib/sqfs/deserialize_fstree.c:279:6
    #4 0x814d26c in sqfs_reader_open /home/dremann/Development/squashfs-tools-ng/lib/sqfs/sqfs_reader.c:46:6
    #5 0x813a4fa in main /home/dremann/Development/squashfs-tools-ng/unpack/rdsquashfs.c:33:6
    #6 0xf7c7f750 in __libc_start_main (/lib32/libc.so.6+0x1e750)
    #7 0x8062561 in _start (/home/dremann/Development/squashfs-tools-ng/rdsquashfs+0x8062561)

0xf4d038bc is located 0 bytes to the right of 14268-byte region [0xf4d00100,0xf4d038bc)
allocated by thread T0 here:
    #0 0x8109575 in calloc (/home/dremann/Development/squashfs-tools-ng/rdsquashfs+0x8109575)
    #1 0x8155bfc in read_inode_file_ext /home/dremann/Development/squashfs-tools-ng/lib/sqfs/read_inode.c:135:8
    #2 0x8155bfc in meta_reader_read_inode /home/dremann/Development/squashfs-tools-ng/lib/sqfs/read_inode.c:238
    #3 0x81518f4 in fill_dir /home/dremann/Development/squashfs-tools-ng/lib/sqfs/deserialize_fstree.c:125:12
    #4 0x8150a07 in deserialize_fstree /home/dremann/Development/squashfs-tools-ng/lib/sqfs/deserialize_fstree.c:279:6
    #5 0x814d26c in sqfs_reader_open /home/dremann/Development/squashfs-tools-ng/lib/sqfs/sqfs_reader.c:46:6

SUMMARY: AddressSanitizer: heap-buffer-overflow /home/dremann/Development/squashfs-tools-ng/lib/sqfs/tree_node_from_inode.c:66:36 in copy_block_sizes
Shadow bytes around the buggy address:
  0x3e9a06c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x3e9a06d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x3e9a06e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x3e9a06f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x3e9a0700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x3e9a0710: 00 00 00 00 00 00 00[04]fa fa fa fa fa fa fa fa
  0x3e9a0720: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x3e9a0730: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x3e9a0740: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x3e9a0750: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x3e9a0760: 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
==32435==ABORTING