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

stack buffer overflow in get_fileinfo (lrzip.c:979) #74

Closed
bestshow opened this issue May 13, 2017 · 1 comment
Closed

stack buffer overflow in get_fileinfo (lrzip.c:979) #74

bestshow opened this issue May 13, 2017 · 1 comment

Comments

@bestshow
Copy link

bestshow commented May 13, 2017

on lrzip version 0.631

#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

testcase:https://github.com/bestshow/p0cs/blob/master/stack-buffer-overflow-in-get_fileinfo-lrzip979
Credit: ADLab of Venustech

@ckolivas
Copy link
Owner

Fixed in f12c4a3

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