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 0x7fff0e9e9038 at pc 0x7f8ece5fb795 bp 0x7fff0e9e8da0 sp 0x7fff0e9e8550
WRITE of size 10 at 0x7fff0e9e9038 thread T0
    #0 0x7f8ece5fb794 in __interceptor_read ../../../../libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:545
    #1 0x413f27 in get_fileinfo /home/haojun/Downloads/lrzip-master/lrzip.c:1074
    #2 0x409ee1 in main /home/haojun/Downloads/lrzip-master/main.c:671
    #3 0x7f8ecd337b34 in __libc_start_main (/lib64/libc.so.6+0x21b34)
    #4 0x403648  (/home/haojun/Downloads/lrzip-build/bin/lrzip+0x403648)

Address 0x7fff0e9e9038 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' <== Memory access at offset 424 overflows this variable
    [480, 496) 'stream_head'
    [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:
  0x100061d351b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x100061d351c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x100061d351d0: 00 00 f1 f1 f1 f1 01 f4 f4 f4 f2 f2 f2 f2 01 f4
  0x100061d351e0: f4 f4 f2 f2 f2 f2 00 f4 f4 f4 f2 f2 f2 f2 00 f4
  0x100061d351f0: f4 f4 f2 f2 f2 f2 00 f4 f4 f4 f2 f2 f2 f2 00 f4
=>0x100061d35200: f4 f4 f2 f2 f2 f2 00[f4]f4 f4 f2 f2 f2 f2 00 00
  0x100061d35210: f4 f4 f2 f2 f2 f2 00 00 f4 f4 f2 f2 f2 f2 00 00
  0x100061d35220: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x100061d35230: f4 f4 f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00
  0x100061d35240: 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 04 f4
  0x100061d35250: 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_24.html

评论

此博客中的热门博文

qpdf:An infinite loop in libqpdf

qpdf:An infinite loop in libqpdf

qpdf:An infinite loop in libqpdf