[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug binutils/30364] New: [Objdump] heap-buffer-overflow at byte_get_lit
From: |
ziqiaokong at gmail dot com |
Subject: |
[Bug binutils/30364] New: [Objdump] heap-buffer-overflow at byte_get_little_endian (display_debug_types) |
Date: |
Mon, 17 Apr 2023 16:40:27 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=30364
Bug ID: 30364
Summary: [Objdump] heap-buffer-overflow at
byte_get_little_endian (display_debug_types)
Product: binutils
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: binutils
Assignee: unassigned at sourceware dot org
Reporter: ziqiaokong at gmail dot com
Target Milestone: ---
Created attachment 14832
--> https://sourceware.org/bugzilla/attachment.cgi?id=14832&action=edit
Full logs and the object file
Git commit hash: 93c6e8c3c14bf81020ca7571fe752250a34f5bc9
This looks duplicate to #30361 but I'm not very sure as they have different
backtraces.
Steps to reproduce:
```
export CC=afl-clang-fast
export CXX=afl-clang-fast++
export AFL_USE_ASAN=1
export CFLAGS="-latomic --ld-path=/usr/bin/ld.lld-14"
export CFLAGS_FOR_TARGETS="-latomic --ld-path=/usr/bin/ld.lld-14"
export CXXFLAGS="-latomic --ld-path=/usr/bin/ld.lld-14"
./configure
make -j
./binutils/objdump -g /path/to/obj
```
Note this doesn't have to be reproduced with AFL++ but gdbserver fails to build
with just specifying `CFLAGS=-fsanitize=address` due to `-Wl,--no-undefined`,
which `afl-clang-fast++` will handle automatically and make things easy.
ASAN logs:
```
<some objdump logs...>
./binutils/objdump: Error: read LEB value is too large to store in destination
variable
=================================================================
==458591==ERROR: AddressSanitizer: heap-buffer-overflow on address
0x60c0000000fc at pc 0x56089ff64c6d bp 0x7ffda41556a0 sp 0x7ffda4155698
READ of size 1 at 0x60c0000000fc thread T0
#0 0x56089ff64c6c in byte_get_little_endian
/binutils/binutils/elfcomm.c:118:26
#1 0x56089ff06020 in fetch_indexed_string
/binutils/binutils/./dwarf.c:683:16
#2 0x56089ff00972 in read_and_display_attr_value
/binutils/binutils/./dwarf.c:2677:12
#3 0x56089feb3d56 in read_and_display_attr
/binutils/binutils/./dwarf.c:3478:10
#4 0x56089feb3d56 in process_debug_info
/binutils/binutils/./dwarf.c:4079:15
#5 0x56089feeea22 in display_debug_types
/binutils/binutils/./dwarf.c:7572:10
#6 0x56089fe947ab in dump_dwarf_section
/binutils/binutils/./objdump.c:4425:6
#7 0x5608a0043feb in bfd_map_over_sections /binutils/bfd/section.c:1366:5
#8 0x56089fe92cde in dump_dwarf /binutils/binutils/./objdump.c:4463:3
#9 0x56089fe8ff91 in dump_bfd /binutils/binutils/./objdump.c:5707:4
#10 0x56089fe8cd98 in display_object_bfd /binutils/binutils/./objdump.c
#11 0x56089fe8cd98 in display_any_bfd /binutils/binutils/./objdump.c:5831:5
#12 0x56089fe8ab12 in display_file /binutils/binutils/./objdump.c:5852:3
#13 0x56089fe8ab12 in main /binutils/binutils/./objdump.c:6263:6
#14 0x7f73cb08ad8f in __libc_start_call_main
csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#15 0x7f73cb08ae3f in __libc_start_main csu/../csu/libc-start.c:392:3
#16 0x56089fdca484 in _start (/binutils/binutils/objdump+0x2ea484)
(BuildId: 58d40a2c01ab14b9)
0x60c0000000fc is located 4 bytes to the left of 113-byte region
[0x60c000000100,0x60c000000171)
allocated by thread T0 here:
#0 0x56089fe4d2ce in malloc (/binutils/binutils/objdump+0x36d2ce) (BuildId:
58d40a2c01ab14b9)
#1 0x5608a033a978 in xmalloc /binutils/libiberty/./xmalloc.c:149:12
#2 0x56089feb0111 in load_debug_section_with_follow
/binutils/binutils/./dwarf.c:3496:7
#3 0x56089feb0111 in process_debug_info /binutils/binutils/./dwarf.c:3665:7
#4 0x56089fecabbf in display_debug_info
/binutils/binutils/./dwarf.c:7566:10
SUMMARY: AddressSanitizer: heap-buffer-overflow
/binutils/binutils/elfcomm.c:118:26 in byte_get_little_endian
Shadow bytes around the buggy address:
0x0c187fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c187fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c187fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c187fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c187fff8000: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
=>0x0c187fff8010: fd fd fd fd fd fd fd fa fa fa fa fa fa fa fa[fa]
0x0c187fff8020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 fa
0x0c187fff8030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c187fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c187fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c187fff8060: 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
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
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
==458591==ABORTING
```
See attached for the full logs.
System environment:
```
[afl++ amdsuplus3] /binutils ((93c6e8c3c14...)) # clang --version
Ubuntu clang version 14.0.6
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
[afl++ amdsuplus3] /binutils ((93c6e8c3c14...)) # clang++ --version
Ubuntu clang version 14.0.6
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
[afl++ amdsuplus3] /binutils ((93c6e8c3c14...)) # ld.lld-14 --version
Ubuntu LLD 14.0.6 (compatible with GNU linkers)
[afl++ amdsuplus3] /binutils ((93c6e8c3c14...)) # uname -a
Linux amdsuplus3.inf.ethz.ch 5.4.0-146-generic #163-Ubuntu SMP Fri Mar 17
18:26:02 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
[afl++ amdsuplus3] /binutils ((93c6e8c3c14...)) #
```
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug binutils/30364] New: [Objdump] heap-buffer-overflow at byte_get_little_endian (display_debug_types),
ziqiaokong at gmail dot com <=