bug-binutils
[Top][All Lists]
Advanced

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

[Bug binutils/22113] New: Heap out of bounds read in bfd_getl16()


From: fumfi.255 at gmail dot com
Subject: [Bug binutils/22113] New: Heap out of bounds read in bfd_getl16()
Date: Fri, 08 Sep 2017 08:35:20 +0000

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

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

ASAN:

==6445==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6270000188ff
at pc 0x0000006626b9 bp 0x7fff0381c340 sp 0x7fff0381c338
READ of size 1 at 0x6270000188ff thread T0
    #0 0x6626b8 in bfd_getl16 XYZ/binutils-2.29/bfd/libbfd.c:505:27
    #1 0x857399 in pe_print_idata XYZ/binutils-2.29/bfd/peigen.c:1562:15
    #2 0x857399 in _bfd_pe_print_private_bfd_data_common
XYZ/binutils-2.29/bfd/peigen.c:2904
    #3 0x83ea08 in pe_print_private_bfd_data
XYZ/binutils-2.29/bfd/./peicode.h:336:8
    #4 0x4e9b57 in dump_bfd_private_header
XYZ/binutils-2.29/binutils/./objdump.c:2920:3
    #5 0x4e9b57 in dump_bfd XYZ/binutils-2.29/binutils/./objdump.c:3504
    #6 0x4e8be1 in display_object_bfd
XYZ/binutils-2.29/binutils/./objdump.c:3603:7
    #7 0x4e8be1 in display_any_bfd XYZ/binutils-2.29/binutils/./objdump.c:3692
    #8 0x4e7d5a in display_file XYZ/binutils-2.29/binutils/./objdump.c:3713:3
    #9 0x4e7d5a in main XYZ/binutils-2.29/binutils/./objdump.c:4015
    #10 0x7f3a3d3c182f in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #11 0x419d98 in _start (XYZ/binutils-2.29/binutils/objdump+0x419d98)

0x6270000188ff is located 1 bytes to the left of 12336-byte region
[0x627000018900,0x62700001b930)
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 0x856c9e in pe_print_idata XYZ/binutils-2.29/bfd/peigen.c:1388:8
    #3 0x856c9e in _bfd_pe_print_private_bfd_data_common
XYZ/binutils-2.29/bfd/peigen.c:2904
    #4 0x83ea08 in pe_print_private_bfd_data
XYZ/binutils-2.29/bfd/./peicode.h:336:8
    #5 0x4e8be1 in display_object_bfd
XYZ/binutils-2.29/binutils/./objdump.c:3603:7
    #6 0x4e8be1 in display_any_bfd XYZ/binutils-2.29/binutils/./objdump.c:3692
    #7 0x4e7d5a in display_file XYZ/binutils-2.29/binutils/./objdump.c:3713:3
    #8 0x4e7d5a in main XYZ/binutils-2.29/binutils/./objdump.c:4015
    #9 0x7f3a3d3c182f in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

SUMMARY: AddressSanitizer: heap-buffer-overflow
XYZ/binutils-2.29/bfd/libbfd.c:505:27 in bfd_getl16
Shadow bytes around the buggy address:
  0x0c4e7fffb0c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4e7fffb0d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4e7fffb0e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4e7fffb0f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4e7fffb100: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c4e7fffb110: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa[fa]
  0x0c4e7fffb120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4e7fffb130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4e7fffb140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4e7fffb150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c4e7fffb160: 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
==6445==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]