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

out of bounds heap read in r_str_glob #2836

Closed
hannob opened this issue Jun 23, 2015 · 0 comments
Closed

out of bounds heap read in r_str_glob #2836

hannob opened this issue Jun 23, 2015 · 0 comments

Comments

@hannob
Copy link

hannob commented Jun 23, 2015

This script causes a heap oob:
https://crashes.fuzzing-project.org/radare2-oob-heap-read-r_str_glob
Contains "l0 *00" string.

Test: radare2 -q -i [script] /dev/null
Found with american fuzzy lop.

Address Sanitizer trace:

==9040==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200001674f at pc 0x7fc9be62d712 bp 0x7ffcae1f0c20 sp 0x7ffcae1f0c10
READ of size 2 at 0x60200001674f thread T0
    #0 0x7fc9be62d711 in r_str_glob /f/radare2/radare2/libr/util/str.c:1149
    #1 0x7fc9c39da046 in r_core_syscmd_ls /f/radare2/radare2/libr/core/syscmd.c:162
    #2 0x7fc9c3874383 in cmd_ls /f/radare2/radare2/libr/core/cmd.c:382
    #3 0x7fc9c395973a in r_core_cmd_subst_i /f/radare2/radare2/libr/core/cmd.c:1590
    #4 0x7fc9c38ba8c4 in r_core_cmd_subst /f/radare2/radare2/libr/core/cmd.c:1081
    #5 0x7fc9c38bbaa3 in r_core_cmd /f/radare2/radare2/libr/core/cmd.c:1938
    #6 0x7fc9c38be8f4 in r_core_cmd_lines /f/radare2/radare2/libr/core/cmd.c:1989
    #7 0x7fc9c38beb64 in r_core_cmd_file /f/radare2/radare2/libr/core/cmd.c:2001
    #8 0x7fc9c38c1ba3 in r_core_run_script /f/radare2/radare2/libr/core/cmd.c:373
    #9 0x405572 in main /f/radare2/radare2/binr/radare2/radare2.c:729
    #10 0x7fc9bde22f9f in __libc_start_main (/lib64/libc.so.6+0x1ff9f)
    #11 0x40a333 (/mnt/ram/radare2/radare2+0x40a333)

0x60200001674f is located 1 bytes to the left of 2-byte region [0x602000016750,0x602000016752)
allocated by thread T0 here:
    #0 0x7fc9c3fec6f7 in malloc (/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/libasan.so.1+0x576f7)
    #1 0x7fc9bde84789 in strdup (/lib64/libc.so.6+0x81789)

SUMMARY: AddressSanitizer: heap-buffer-overflow /f/radare2/radare2/libr/util/str.c:1149 r_str_glob
Shadow bytes around the buggy address:
  0x0c047fffac90: fa fa 04 fa fa fa 00 03 fa fa 00 fa fa fa 06 fa
  0x0c047fffaca0: fa fa 00 00 fa fa 00 06 fa fa 00 05 fa fa 00 03
  0x0c047fffacb0: fa fa 07 fa fa fa 06 fa fa fa 00 fa fa fa 00 02
  0x0c047fffacc0: fa fa 03 fa fa fa 00 fa fa fa 03 fa fa fa 00 02
  0x0c047fffacd0: fa fa 00 04 fa fa 00 02 fa fa 04 fa fa fa 02 fa
=>0x0c047ffface0: fa fa 04 fa fa fa 03 fa fa[fa]02 fa fa fa 04 fa
  0x0c047fffacf0: fa fa 01 fa fa fa 07 fa fa fa 07 fa fa fa 07 fa
  0x0c047fffad00: fa fa fd fa fa fa fd fd fa fa 06 fa fa fa fd fa
  0x0c047fffad10: fa fa 05 fa fa fa fd fa fa fa 06 fa fa fa fd fa
  0x0c047fffad20: fa fa 06 fa fa fa 03 fa fa fa fd fa fa fa 04 fa
  0x0c047fffad30: fa fa fd fa fa fa fd fa fa fa 04 fa fa fa fd 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
  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
  Contiguous container OOB:fc
  ASan internal:           fe
==9040==ABORTING
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