bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/22058] New: Heap out of bounds read in _bfd_elf_attr_strdu


From: fumfi.255 at gmail dot com
Subject: [Bug binutils/22058] New: Heap out of bounds read in _bfd_elf_attr_strdup()
Date: Fri, 01 Sep 2017 07:22:56 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=22058

            Bug ID: 22058
           Summary: Heap out of bounds read in _bfd_elf_attr_strdup()
           Product: binutils
           Version: 2.29
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: fumfi.255 at gmail dot com
  Target Milestone: ---

Created attachment 10383
  --> https://sourceware.org/bugzilla/attachment.cgi?id=10383&action=edit
POC to trigger heap out of bounds read (objdump)

After some fuzz testing I found a crashing test case.

Version: 2.29

Command: objdump -x -Wl -R -SD objdump_hoobr_bfd_elf_attr_strdup

ASAN:

==29788==ERROR: AddressSanitizer: heap-buffer-overflow on address
0x619000004090 at pc 0x000000424b5f bp 0x7fff480b0c50 sp 0x7fff480b03f8
READ of size 1 at 0x619000004090 thread T0
    #0 0x424b5e in __interceptor_strlen
/home/llvm/clang-3.9/final/llvm.src/projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:227:5
    #1 0x794012 in _bfd_elf_attr_strdup XYZ/binutils-2.29/bfd/elf-attrs.c:310:9
    #2 0x794012 in bfd_elf_add_obj_attr_string
XYZ/binutils-2.29/bfd/elf-attrs.c:323
    #3 0x796201 in _bfd_elf_parse_attributes
XYZ/binutils-2.29/bfd/elf-attrs.c:533:6
    #4 0x6e3766 in bfd_section_from_shdr XYZ/binutils-2.29/bfd/elf.c:2448:4
    #5 0x803733 in bfd_elf32_object_p XYZ/binutils-2.29/bfd/./elfcode.h:805:7
    #6 0x65bf6c in bfd_check_format_matches
XYZ/binutils-2.29/bfd/format.c:311:14
    #7 0x4e8bb5 in display_object_bfd
XYZ/binutils-2.29/binutils/./objdump.c:3601:7
    #8 0x4e8bb5 in display_any_bfd XYZ/binutils-2.29/binutils/./objdump.c:3692
    #9 0x4e7d5a in display_file XYZ/binutils-2.29/binutils/./objdump.c:3713:3
    #10 0x4e7d5a in main XYZ/binutils-2.29/binutils/./objdump.c:4015
    #11 0x7ff780a6f82f in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #12 0x419d98 in _start (XYZ/binutils-2.29/binutils/objdump+0x419d98)

0x619000004090 is located 0 bytes to the right of 1040-byte region
[0x619000003c80,0x619000004090)
allocated by thread T0 here:
    #0 0x4b85ac in malloc
/home/llvm/clang-3.9/final/llvm.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:64:3
    #1 0x6618b3 in bfd_malloc XYZ/binutils-2.29/bfd/libbfd.c:193:9
    #2 0x6e3766 in bfd_section_from_shdr XYZ/binutils-2.29/bfd/elf.c:2448:4

SUMMARY: AddressSanitizer: heap-buffer-overflow
/home/llvm/clang-3.9/final/llvm.src/projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:227:5
in __interceptor_strlen
Shadow bytes around the buggy address:
  0x0c327fff87c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c327fff87d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c327fff87e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c327fff87f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c327fff8800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c327fff8810: 00 00[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c327fff8820: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c327fff8830: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c327fff8840: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c327fff8850: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c327fff8860: 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
  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
==29788==ABORTING

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]