bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/24689] New: Heap-buffer-overflow in _bfd_doprnt in bfd.c in bfd


From: 15664243668 at 163 dot com
Subject: [Bug ld/24689] New: Heap-buffer-overflow in _bfd_doprnt in bfd.c in bfd
Date: Mon, 17 Jun 2019 03:23:41 +0000

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

            Bug ID: 24689
           Summary: Heap-buffer-overflow in _bfd_doprnt in bfd.c in bfd
           Product: binutils
           Version: 2.32
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: 15664243668 at 163 dot com
  Target Milestone: 2.32

Created attachment 11840
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11840&action=edit
POC

Hi, 

A Heap-buffer-overflow problem was discovered in _bfd_doprnt in bfd.c in bfd,
as distributed in binutils v2.32. A crafted ELF input can cause crash with
being executed by size in binutils v2.32 and I have confirmed them with address
sanitizer too.

Here are the POC files. Please use "size $POC" to reproduce the error.


ASAN dumps the backtrace as follow:


=================================================================
==20018==ERROR: AddressSanitizer: heap-buffer-overflow on address 0xf4a038e0 at
pc 0xf7ac14fb bp 0xffffceb8 sp 0xffffca6c
READ of size 554 at 0xf4a038e0 thread T0
    #0 0xf7ac14fa  (/usr/lib32/libasan.so.2+0x5a4fa)
    #1 0xf7b055c4 in __asan_report_error (/usr/lib32/libasan.so.2+0x9e5c4)
    #2 0xf7ac13d9  (/usr/lib32/libasan.so.2+0x5a3d9)
    #3 0xf7ac1b88 in __interceptor_vfprintf (/usr/lib32/libasan.so.2+0x5ab88)
    #4 0xf7ac1c0c in fprintf (/usr/lib32/libasan.so.2+0x5ac0c)
    #5 0x807d3ff in _bfd_doprnt
/home/zeroyu/experiment_without_cov/binutils-2.32/bfd/bfd.c:871
    #6 0x807d3ff in error_handler_internal
/home/zeroyu/experiment_without_cov/binutils-2.32/bfd/bfd.c:1136
    #7 0x8079004 in _bfd_error_handler
/home/zeroyu/experiment_without_cov/binutils-2.32/bfd/bfd.c:1178
    #8 0x818eb08 in _bfd_elf_setup_sections
/home/zeroyu/experiment_without_cov/binutils-2.32/bfd/elf.c:866
    #9 0x838f661 in bfd_elf32_object_p
/home/zeroyu/experiment_without_cov/binutils-2.32/bfd/elfcode.h:822
    #10 0x8094407 in bfd_check_format_matches
/home/zeroyu/experiment_without_cov/binutils-2.32/bfd/format.c:315
    #11 0x8053d8e in display_bfd
/home/zeroyu/experiment_without_cov/binutils-2.32/binutils/size.c:304
    #12 0x8053d8e in display_file
/home/zeroyu/experiment_without_cov/binutils-2.32/binutils/size.c:407
    #13 0x804f2ed in main
/home/zeroyu/experiment_without_cov/binutils-2.32/binutils/size.c:241
    #14 0xf78c6636 in __libc_start_main (/lib32/libc.so.6+0x18636)
    #15 0x805136b 
(/home/zeroyu/experiment_without_cov/binutilstest_with_asan_but_no_cov/bin/size+0x805136b)

0xf4a038e0 is located 0 bytes to the right of 4064-byte region
[0xf4a02900,0xf4a038e0)
allocated by thread T0 here:
    #0 0xf7afddee in malloc (/usr/lib32/libasan.so.2+0x96dee)
    #1 0x862ac99 in objalloc_create objalloc.c:95

SUMMARY: AddressSanitizer: heap-buffer-overflow ??:0 ??
Shadow bytes around the buggy address:
  0x3e9406c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x3e9406d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x3e9406e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x3e9406f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x3e940700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x3e940710: 00 00 00 00 00 00 00 00 00 00 00 00[fa]fa fa fa
  0x3e940720: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x3e940730: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x3e940740: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x3e940750: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x3e940760: 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
==20018==ABORTING
[Inferior 1 (process 20018) exited with code 01]

-- 
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]