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-buffer-overflow at WritePixel() in ngiflib.c:123 #11

Closed
Marsman1996 opened this issue Apr 13, 2019 · 1 comment
Closed

heap-buffer-overflow at WritePixel() in ngiflib.c:123 #11

Marsman1996 opened this issue Apr 13, 2019 · 1 comment

Comments

@Marsman1996
Copy link

Tested in Ubuntu 16.04, 64bit, ngiflib(master 3bb9980)

Triggered by
$ gif2tga $POC

POC file:
https://github.com/Marsman1996/pocs/blob/master/ngiflib/poc13-WritePixel-heapoverflow

ASAN info:

==122089==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x621000002500 at pc 0x55dc592dfd89 bp 0x7ffc11226c20 sp 0x7ffc11226c10
WRITE of size 4 at 0x621000002500 thread T0
    #0 0x55dc592dfd88 in WritePixel /home/ubuntu/Desktop/crashana/ngiflib/ngiflib/ngiflib.c:123
    #1 0x55dc592dfd88 in DecodeGifImg /home/ubuntu/Desktop/crashana/ngiflib/ngiflib/ngiflib.c:544
    #2 0x55dc592e1e3b in LoadGif /home/ubuntu/Desktop/crashana/ngiflib/ngiflib/ngiflib.c:809
    #3 0x55dc592dcdc4 in main /home/ubuntu/Desktop/crashana/ngiflib/ngiflib/gif2tga.c:95
    #4 0x7f29ccd05b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
    #5 0x55dc592dc169 in _start (/home/ubuntu/Desktop/crashana/ngiflib/ngiflib/gif2tga+0x2169)

0x621000002500 is located 0 bytes to the right of 4096-byte region [0x621000001500,0x621000002500)
allocated by thread T0 here:
    #0 0x7f29cd1b3b50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
    #1 0x55dc592e0a38 in LoadGif /home/ubuntu/Desktop/crashana/ngiflib/ngiflib/ngiflib.c:627

SUMMARY: AddressSanitizer: heap-buffer-overflow /home/ubuntu/Desktop/crashana/ngiflib/ngiflib/ngiflib.c:123 in WritePixel
Shadow bytes around the buggy address:
  0x0c427fff8450: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c427fff8460: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c427fff8470: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c427fff8480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c427fff8490: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c427fff84a0:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c427fff84b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c427fff84c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c427fff84d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c427fff84e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c427fff84f0: 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
==122089==ABORTING
@miniupnp
Copy link
Owner

fixed by 37d939a

miniupnp added a commit that referenced this issue Apr 16, 2019
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