libming:heap buffer overflow in OpCode

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 OpCode in decompile.c, which allows attackers to cause a denial of service via a crafted file.

#swftocxx $FILE out
=================================================================
heap-buffer-overflow on address 0x6120000005f0 at pc 0x000000560490 bp 0x7ffdb7ed2610 sp 0x7ffdb7ed2608
READ of size 1 at 0x6120000005f0 thread T0
    #0 0x56048f in OpCode /home/haojun/Downloads/libming-master/util/decompile.c:868:37
    #1 0x56048f in decompileINCR_DECR /home/haojun/Downloads/libming-master/util/decompile.c:1474
    #2 0x537f24 in decompileAction /home/haojun/Downloads/libming-master/util/decompile.c:3222:10
    #3 0x5875eb in decompileActions /home/haojun/Downloads/libming-master/util/decompile.c:3401:6
    #4 0x5875eb in decompile5Action /home/haojun/Downloads/libming-master/util/decompile.c:3423
    #5 0x52a0c5 in outputSWF_DOACTION /home/haojun/Downloads/libming-master/util/outputscript.c:1548:29
    #6 0x531311 in readMovie /home/haojun/Downloads/libming-master/util/main.c:277:4
    #7 0x531311 in main /home/haojun/Downloads/libming-master/util/main.c:350
    #8 0x7f1423d73b34 in __libc_start_main /usr/src/debug/glibc-2.17-c758a686/csu/../csu/libc-start.c:274
    #9 0x41ae7b in _start (/home/haojun/Downloads/libming-afl-build/bin/swftocxx+0x41ae7b)

0x6120000005f0 is located 40 bytes to the right of 264-byte region [0x6120000004c0,0x6120000005c8)
allocated by thread T0 here:
    #0 0x4dff2d in calloc /home/haojun/Downloads/llvm-clang/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:74
    #1 0x5beb8c in parseSWF_DOACTION /home/haojun/Downloads/libming-master/util/parser.c:2428:3
    #2 0x7f1423d73b34 in __libc_start_main /usr/src/debug/glibc-2.17-c758a686/csu/../csu/libc-start.c:274

heap-buffer-overflow /home/haojun/Downloads/libming-master/util/decompile.c:868:37 in OpCode
Shadow bytes around the buggy address:
  0x0c247fff8060: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
  0x0c247fff8070: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c247fff8080: fd fd fd fd fd fd fd fd fd fa fa fa fa fa fa fa
  0x0c247fff8090: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c247fff80a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c247fff80b0: 00 00 00 00 00 00 00 00 00 fa fa fa fa fa[fa]fa
  0x0c247fff80c0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c247fff80d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c247fff80e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c247fff80f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c247fff8100: 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
==16682==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-opcode_24.html

评论

此博客中的热门博文

libming:memory leak in parseSWF_SHAPEWITHSTYLE

libming:memory leak in parseSWF_DOACTION

lrzip:stack buffer overflow in get_fileinfo