lrzip:stack buffer overflow in get_fileinfo

Description

lrzip, a compression utility that excels at compressing large files (usually > 10-50 MB). Larger files and/or more free RAM means that the utility will be able to more effectively compress your files (ie: faster / smaller size), especially if the filesize(s) exceed 100 MB. You can either choose to optimise for speed (fast compression / decompression) or size, but not both.

A stack buffer overflow was found in function get_fileinfo in lrzip.c,which allows attackers to cause a denial of service via a crafted file.

#lrzip -i $FILE
stack-buffer-overflow on address 0x7fffdd1d38b8 at pc 0x7fcd199a9795 bp 0x7fffdd1d3620 sp 0x7fffdd1d2dd0
WRITE of size 65 at 0x7fffdd1d38b8 thread T0
    #0 0x7fcd199a9794 in __interceptor_read ../../../../libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:545
    #1 0x412cf0 in get_fileinfo /home/haojun/Downloads/lrzip-master/lrzip.c:979
    #2 0x409ee1 in main /home/haojun/Downloads/lrzip-master/main.c:671
    #3 0x7fcd186e5b34 in __libc_start_main (/lib64/libc.so.6+0x21b34)
    #4 0x403648  (/home/haojun/Downloads/lrzip-build/bin/lrzip+0x403648)

Address 0x7fffdd1d38b8 is located in stack of thread T0 at offset 424 in frame
    #0 0x412454 in get_fileinfo /home/haojun/Downloads/lrzip-master/lrzip.c:926

  This frame has 10 object(s):
    [32, 33) 'chunk_byte'
    [96, 97) 'ctype'
    [160, 168) 'u_len'
    [224, 232) 'c_len'
    [288, 296) 'last_head'
    [352, 360) 'expected_size'
    [416, 424) 'chunk_size'
    [480, 496) 'stream_head' <== Memory access at offset 424 partially underflows this variable
    [544, 560) 'md5_stored'
    [608, 752) 'fdin_stat'
HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext
      (longjmp and C++ exceptions *are* supported)
SUMMARY:  stack-buffer-overflow ../../../../libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:545 in __interceptor_read
Shadow bytes around the buggy address:
  0x10007ba326c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10007ba326d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10007ba326e0: 00 00 f1 f1 f1 f1 01 f4 f4 f4 f2 f2 f2 f2 01 f4
  0x10007ba326f0: f4 f4 f2 f2 f2 f2 00 f4 f4 f4 f2 f2 f2 f2 00 f4
  0x10007ba32700: f4 f4 f2 f2 f2 f2 00 f4 f4 f4 f2 f2 f2 f2 00 f4
=>0x10007ba32710: f4 f4 f2 f2 f2 f2 00[f4]f4 f4 f2 f2 f2 f2 00 00
  0x10007ba32720: f4 f4 f2 f2 f2 f2 00 00 f4 f4 f2 f2 f2 f2 00 00
  0x10007ba32730: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10007ba32740: f4 f4 f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00
  0x10007ba32750: 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 04 f4
  0x10007ba32760: f4 f4 f2 f2 f2 f2 04 f4 f4 f4 f2 f2 f2 f2 00 f4
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

Affected version: 0.631
Fixed version:N/A
Commit fix:N/A
Credit: ADLab of Venustech.
CVE:N/A
Reproducer:
Timeline:
2017-05-13:bug discovered and reported to the lrzip GitHub issue page
2017-06-25:blog post about the issue
Permalink:

http://somevulnsofadlab.blogspot.com/2017/06/lrzipstack-buffer-overflow-in.html

评论

此博客中的热门博文

qpdf:An infinite loop in libqpdf

qpdf:An infinite loop in libqpdf

qpdf:An infinite loop in libqpdf