Skip to content

Heap buffer overflow #3479

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

Closed
clayton-shopify opened this issue Mar 1, 2017 · 0 comments
Closed

Heap buffer overflow #3479

clayton-shopify opened this issue Mar 1, 2017 · 0 comments

Comments

@clayton-shopify
Copy link
Contributor

The following input demonstrates a crash:

[][]=%

[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]-=0

ASAN report:

==35614==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61d00001de88 at pc 0x00010f0669fa bp 0x7fff50cfe870 sp 0x7fff50cfe868
WRITE of size 4 at 0x61d00001de88 thread T0
    #0 0x10f0669f9 in mrb_vm_exec (mruby+0x10016e9f9)
    #1 0x10f05e379 in mrb_vm_run (mruby+0x100166379)
    #2 0x10f08fb99 in mrb_top_run (mruby+0x100197b99)
    #3 0x10f15e665 in mrb_load_exec (mruby+0x100266665)
    #4 0x10f15f475 in mrb_load_file_cxt (mruby+0x100267475)
    #5 0x10eefa8ca in main mruby.c:232
    #6 0x7fffb4357254 in start (libdyld.dylib+0x5254)

0x61d00001de88 is located 8 bytes to the right of 2048-byte region [0x61d00001d680,0x61d00001de80)
allocated by thread T0 here:
    #0 0x10f29ef87 in wrap_realloc (libclang_rt.asan_osx_dynamic.dylib+0x4af87)
    #1 0x10eff3bb5 in mrb_default_allocf (mruby+0x1000fbbb5)
    #2 0x10ef75068 in mrb_realloc_simple gc.c:201
    #3 0x10ef7574e in mrb_realloc gc.c:215
    #4 0x10ef761c3 in mrb_malloc gc.c:236
    #5 0x10ef7625d in mrb_calloc gc.c:254
    #6 0x10f0557b2 in stack_init (mruby+0x10015d7b2)
    #7 0x10f05271f in mrb_funcall_with_block (mruby+0x10015a71f)
    #8 0x10f052097 in mrb_funcall_with_block (mruby+0x10015a097)
    #9 0x10f051877 in mrb_funcall_argv (mruby+0x100159877)
    #10 0x10ef38735 in mrb_obj_new (mruby+0x100040735)
    #11 0x10ef5d19d in mrb_exc_new_str (mruby+0x10006519d)
    #12 0x10ef677b7 in mrb_init_exception (mruby+0x10006f7b7)
    #13 0x10ef98990 in mrb_init_core (mruby+0x1000a0990)
    #14 0x10eff3b4e in mrb_open_core (mruby+0x1000fbb4e)
    #15 0x10eff3d1c in mrb_open_allocf (mruby+0x1000fbd1c)
    #16 0x10eff3ce7 in mrb_open (mruby+0x1000fbce7)
    #17 0x10eef9647 in main mruby.c:172
    #18 0x7fffb4357254 in start (libdyld.dylib+0x5254)

SUMMARY: AddressSanitizer: heap-buffer-overflow (mruby+0x10016e9f9) in mrb_vm_exec
Shadow bytes around the buggy address:
  0x1c3a00003b80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1c3a00003b90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1c3a00003ba0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1c3a00003bb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1c3a00003bc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x1c3a00003bd0: fa[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c3a00003be0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c3a00003bf0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c3a00003c00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c3a00003c10: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x1c3a00003c20: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
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
==35614==ABORTING
Abort trap: 6

This issue was reported by https://hackerone.com/titanous

@matz matz closed this as completed in 1ab7e7e Mar 2, 2017
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

1 participant