bug-binutils
[Top][All Lists]
Advanced

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

[Bug binutils/21146] New: readelf segfault - multiple invalid write in e


From: thuanpv at comp dot nus.edu.sg
Subject: [Bug binutils/21146] New: readelf segfault - multiple invalid write in elfcomm.c
Date: Mon, 13 Feb 2017 09:56:50 +0000

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

            Bug ID: 21146
           Summary: readelf segfault - multiple invalid write in elfcomm.c
           Product: binutils
           Version: 2.29 (HEAD)
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: thuanpv at comp dot nus.edu.sg
  Target Milestone: ---

Created attachment 9813
  --> https://sourceware.org/bugzilla/attachment.cgi?id=9813&action=edit
Crashing input

Dear all,

This bug was found with AFLGo, a directed version of AFL/AFLFast. Thanks also
to Marcel Böhme. 

This bug was found on Ubuntu 14.04 64-bit & binutils was checkout from main
repository at git://sourceware.org/git/binutils-gdb.git. Its commit is
53f7e8ea7fad1fcff1b58f4cbd74e192e0bcbc1d (Fri Feb 10 00:00:16 2017) 

binutils was built with ASAN using gcc-6.2 and clang-3.4. The configure command
was:

CC=clang CFLAGS="-DFORTIFY_SOURCE=2 -fstack-protector-all
-fsanitize=undefined,address -fno-omit-frame-pointer -g -Wno-error"
../configure --disable-shared --disable-gdb --disable-libdecnumber
--disable-readline --disable-sim

To reproduce:
Download the attached file - bug_12
readelf -R6 bug_12


Valgrinds:
==115836== Invalid write of size 1
==115836==    at 0x438C87: byte_put_little_endian (elfcomm.c:75)
==115836==    by 0x408B97: target_specific_reloc_handling (readelf.c:11640)
==115836==    by 0x408B97: apply_relocations (readelf.c:12343)
==115836==    by 0x40EAC6: dump_section_as_bytes (readelf.c:12744)
==115836==    by 0x42334D: process_section_contents (readelf.c:13085)
==115836==    by 0x42334D: process_object (readelf.c:16780)
==115836==    by 0x402111: process_file (readelf.c:17154)
==115836==    by 0x402111: main (readelf.c:17225)
==115836==  Address 0x5203a08 is 19 bytes after a block of size 5 alloc'd
==115836==    at 0x4C2AB80: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==115836==    by 0x40566E: get_data (readelf.c:393)
==115836==    by 0x40E7EB: dump_section_as_bytes (readelf.c:12685)
==115836==    by 0x42334D: process_section_contents (readelf.c:13085)
==115836==    by 0x42334D: process_object (readelf.c:16780)
==115836==    by 0x402111: process_file (readelf.c:17154)
==115836==    by 0x402111: main (readelf.c:17225)
==115836== 
==115836== Invalid write of size 1
==115836==    at 0x438C91: byte_put_little_endian (elfcomm.c:78)
==115836==    by 0x408B97: target_specific_reloc_handling (readelf.c:11640)
==115836==    by 0x408B97: apply_relocations (readelf.c:12343)
==115836==    by 0x40EAC6: dump_section_as_bytes (readelf.c:12744)
==115836==    by 0x42334D: process_section_contents (readelf.c:13085)
==115836==    by 0x42334D: process_object (readelf.c:16780)
==115836==    by 0x402111: process_file (readelf.c:17154)
==115836==    by 0x402111: main (readelf.c:17225)
==115836==  Address 0x5203a07 is 18 bytes after a block of size 5 alloc'd
==115836==    at 0x4C2AB80: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==115836==    by 0x40566E: get_data (readelf.c:393)
==115836==    by 0x40E7EB: dump_section_as_bytes (readelf.c:12685)
==115836==    by 0x42334D: process_section_contents (readelf.c:13085)
==115836==    by 0x42334D: process_object (readelf.c:16780)
==115836==    by 0x402111: process_file (readelf.c:17154)
==115836==    by 0x402111: main (readelf.c:17225)
==115836== 
==115836== Invalid write of size 1
==115836==    at 0x438C9B: byte_put_little_endian (elfcomm.c:81)
==115836==    by 0x408B97: target_specific_reloc_handling (readelf.c:11640)
==115836==    by 0x408B97: apply_relocations (readelf.c:12343)
==115836==    by 0x40EAC6: dump_section_as_bytes (readelf.c:12744)
==115836==    by 0x42334D: process_section_contents (readelf.c:13085)
==115836==    by 0x42334D: process_object (readelf.c:16780)
==115836==    by 0x402111: process_file (readelf.c:17154)
==115836==    by 0x402111: main (readelf.c:17225)
==115836==  Address 0x5203a06 is 17 bytes after a block of size 5 alloc'd
==115836==    at 0x4C2AB80: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==115836==    by 0x40566E: get_data (readelf.c:393)
==115836==    by 0x40E7EB: dump_section_as_bytes (readelf.c:12685)
==115836==    by 0x42334D: process_section_contents (readelf.c:13085)
==115836==    by 0x42334D: process_object (readelf.c:16780)
==115836==    by 0x402111: process_file (readelf.c:17154)
==115836==    by 0x402111: main (readelf.c:17225)
==115836== 
==115836== Invalid write of size 1
==115836==    at 0x438C9E: byte_put_little_endian (elfcomm.c:84)
==115836==    by 0x408B97: target_specific_reloc_handling (readelf.c:11640)
==115836==    by 0x408B97: apply_relocations (readelf.c:12343)
==115836==    by 0x40EAC6: dump_section_as_bytes (readelf.c:12744)
==115836==    by 0x42334D: process_section_contents (readelf.c:13085)
==115836==    by 0x42334D: process_object (readelf.c:16780)
==115836==    by 0x402111: process_file (readelf.c:17154)
==115836==    by 0x402111: main (readelf.c:17225)
==115836==  Address 0x5203a05 is 16 bytes after a block of size 5 alloc'd
==115836==    at 0x4C2AB80: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==115836==    by 0x40566E: get_data (readelf.c:393)
==115836==    by 0x40E7EB: dump_section_as_bytes (readelf.c:12685)
==115836==    by 0x42334D: process_section_contents (readelf.c:13085)
==115836==    by 0x42334D: process_object (readelf.c:16780)
==115836==    by 0x402111: process_file (readelf.c:17154)
==115836==    by 0x402111: main (readelf.c:17225)


ASAN says
==106328==ERROR: AddressSanitizer: heap-buffer-overflow on address
0x60200000ef08 at pc 0x722a9d bp 0x7ffd0053e0b0 sp 0x7ffd0053e0a8
WRITE of size 1 at 0x60200000ef08 thread T0
    #0 0x722a9c in byte_put_little_endian
/home/ubuntu/thesis/subjects/binutils-newest/build-asan/binutils/../../binutils/elfcomm.c:75
    #1 0x54acfa in target_specific_reloc_handling
/home/ubuntu/thesis/subjects/binutils-newest/build-asan/binutils/../../binutils/readelf.c:11640
    #2 0x52e6dc in apply_relocations
/home/ubuntu/thesis/subjects/binutils-newest/build-asan/binutils/../../binutils/readelf.c:12343
    #3 0x55de03 in dump_section_as_bytes
/home/ubuntu/thesis/subjects/binutils-newest/build-asan/binutils/../../binutils/readelf.c:12744
    #4 0x4e1531 in process_section_contents
/home/ubuntu/thesis/subjects/binutils-newest/build-asan/binutils/../../binutils/readelf.c:13085
    #5 0x48d610 in process_object
/home/ubuntu/thesis/subjects/binutils-newest/build-asan/binutils/../../binutils/readelf.c:16780
    #6 0x488365 in process_file
/home/ubuntu/thesis/subjects/binutils-newest/build-asan/binutils/../../binutils/readelf.c:17154
    #7 0x4855c3 in main
/home/ubuntu/thesis/subjects/binutils-newest/build-asan/binutils/../../binutils/readelf.c:17225
    #8 0x7f1ce3bfbf44 (/lib/x86_64-linux-gnu/libc.so.6+0x21f44)
    #9 0x47ddfc in _start
(/home/ubuntu/thesis/subjects/binutils-newest/build-asan/binutils/readelf+0x47ddfc)

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