bug-binutils
[Top][All Lists]
Advanced

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

[Bug binutils/22059] New: Heap out of bounds read in read_1_byte()


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

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

            Bug ID: 22059
           Summary: Heap out of bounds read in read_1_byte()
           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 10384
  --> https://sourceware.org/bugzilla/attachment.cgi?id=10384&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_read_1_byte

ASAN:

==3698==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61200000bb49
at pc 0x0000007c0edd bp 0x7ffc76683070 sp 0x7ffc76683068
READ of size 1 at 0x61200000bb49 thread T0
    #0 0x7c0edc in read_1_byte XYZ/binutils-2.29/bfd/./dwarf2.c:593:10
    #1 0x7c0edc in decode_line_info XYZ/binutils-2.29/bfd/./dwarf2.c:2178
    #2 0x7cafca in comp_unit_find_nearest_line
XYZ/binutils-2.29/bfd/./dwarf2.c:3538:26
    #3 0x7c7c69 in _bfd_dwarf2_find_nearest_line
XYZ/binutils-2.29/bfd/./dwarf2.c:4738:11
    #4 0x7148fb in _bfd_elf_find_nearest_line
XYZ/binutils-2.29/bfd/elf.c:8636:7
    #5 0x4f6709 in show_line XYZ/binutils-2.29/binutils/./objdump.c:1486:9
    #6 0x4f6709 in disassemble_bytes
XYZ/binutils-2.29/binutils/./objdump.c:1791
    #7 0x4f6709 in disassemble_section
XYZ/binutils-2.29/binutils/./objdump.c:2313
    #8 0x66e1d9 in bfd_map_over_sections XYZ/binutils-2.29/bfd/section.c:1395:5
    #9 0x4ebd50 in disassemble_data
XYZ/binutils-2.29/binutils/./objdump.c:2449:3
    #10 0x4ebd50 in dump_bfd XYZ/binutils-2.29/binutils/./objdump.c:3546
    #11 0x4e8be1 in display_object_bfd
XYZ/binutils-2.29/binutils/./objdump.c:3603:7
    #12 0x4e8be1 in display_any_bfd XYZ/binutils-2.29/binutils/./objdump.c:3692
    #13 0x4e7d5a in display_file XYZ/binutils-2.29/binutils/./objdump.c:3713:3
    #14 0x4e7d5a in main XYZ/binutils-2.29/binutils/./objdump.c:4015
    #15 0x7f5b4937a82f in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #16 0x419d98 in _start (XYZ/binutils-2.29/binutils/objdump+0x419d98)

0x61200000bb49 is located 0 bytes to the right of 265-byte region
[0x61200000ba40,0x61200000bb49)
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 0x66f01b in bfd_simple_get_relocated_section_contents
XYZ/binutils-2.29/bfd/simple.c:193:12
    #3 0x7bba33 in read_section XYZ/binutils-2.29/bfd/./dwarf2.c:556:8

SUMMARY: AddressSanitizer: heap-buffer-overflow
XYZ/binutils-2.29/bfd/./dwarf2.c:593:10 in read_1_byte
Shadow bytes around the buggy address:
  0x0c247fff9710: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c247fff9720: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c247fff9730: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c247fff9740: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c247fff9750: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c247fff9760: 00 00 00 00 00 00 00 00 00[01]fa fa fa fa fa fa
  0x0c247fff9770: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c247fff9780: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c247fff9790: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c247fff97a0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c247fff97b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
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
==3698==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]