libming:heap buffer overflow in dcputs

Description

Ming is a library for generating Macromedia Flash files (.swf), written in C, and  for working includes useful utilities king with .swf files.

A heap buffer overflow vulnerability was found in function dcputs in decompile.c, which allows attackers to cause a denial of service via a crafted file.

#swftocxx $FILE out
=================================================================
heap-buffer-overflow on address 0x7fe82faff800 at pc 0x00000047d145 bp 0x7ffe86b6c620 sp 0x7ffe86b6bdd0
WRITE of size 45 at 0x7fe82faff800 thread T0
    #0 0x47d144 in __interceptor_strcat /home/haojun/Downloads/llvm-clang/llvm/projects/compiler-rt/lib/asan/asan_interceptors.cc:491
    #1 0x5459fa in dcputs /home/haojun/Downloads/libming-master/util/decompile.c:104:2
    #2 0x5459fa in decompileIMPLEMENTS /home/haojun/Downloads/libming-master/util/decompile.c:3094
    #3 0x5459fa in decompileAction /home/haojun/Downloads/libming-master/util/decompile.c:3375
    #4 0x5875eb in decompileActions /home/haojun/Downloads/libming-master/util/decompile.c:3401:6
    #5 0x5875eb in decompile5Action /home/haojun/Downloads/libming-master/util/decompile.c:3423
    #6 0x52a0c5 in outputSWF_DOACTION /home/haojun/Downloads/libming-master/util/outputscript.c:1548:29
    #7 0x531311 in readMovie /home/haojun/Downloads/libming-master/util/main.c:277:4
    #8 0x531311 in main /home/haojun/Downloads/libming-master/util/main.c:350
    #9 0x7fe83201bb34 in __libc_start_main /usr/src/debug/glibc-2.17-c758a686/csu/../csu/libc-start.c:274
    #10 0x41ae7b in _start (/home/haojun/Downloads/libming-afl-build/bin/swftocxx+0x41ae7b)

0x7fe82faff800 is located 0 bytes to the right of 327680-byte region [0x7fe82faaf800,0x7fe82faff800)
allocated by thread T0 here:
    #0 0x4e012d in realloc /home/haojun/Downloads/llvm-clang/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:79
    #1 0x545984 in dcchkstr /home/haojun/Downloads/libming-master/util/decompile.c:92:9
    #2 0x545984 in dcputs /home/haojun/Downloads/libming-master/util/decompile.c:103
    #3 0x545984 in decompileIMPLEMENTS /home/haojun/Downloads/libming-master/util/decompile.c:3094
    #4 0x545984 in decompileAction /home/haojun/Downloads/libming-master/util/decompile.c:3375

heap-buffer-overflow /home/haojun/Downloads/llvm-clang/llvm/projects/compiler-rt/lib/asan/asan_interceptors.cc:491 in __interceptor_strcat
Shadow bytes around the buggy address:
  0x0ffd85f57eb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0ffd85f57ec0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0ffd85f57ed0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0ffd85f57ee0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0ffd85f57ef0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0ffd85f57f00:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0ffd85f57f10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0ffd85f57f20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0ffd85f57f30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0ffd85f57f40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0ffd85f57f50: 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
==16605==ABORTING

Affected version: latest version
Fixed version:N/A
Commit fix:N/A
Credit: ADLab of Venustech.
CVE:N/A
Reproducer:
Timeline:
2017-06-07:bug discovered and reported to the libming GitHub issue page
2017-07-24:blog post about the issue
Permalink:
https://somevulnsofadlab.blogspot.com/2017/07/libmingheap-buffer-overflow-in-dcputs.html

评论

此博客中的热门博文

qpdf:An infinite loop in libqpdf

qpdf:An infinite loop in libqpdf

qpdf:An infinite loop in libqpdf