Skip to content

SEGV in resolve_plt_addr at internal.c:1340 #21

@bladchan

Description

@bladchan

Describe the bug
A bad elf file which can lead elf_open_object() to a segmentation fault.
Poc here:
poc3.zip

To Reproduce

  1. Build the whole project with ASAN
  2. Run examples/elfparse
$ ./elfparse ./segv2

Expected behavior
Parse elf file without segmentation fault because segmentation fault can cause a Denial of Service (Dos).

Environment (please complete the following information):

  • System and Version : Ubuntu 18.04 + gcc 7.5.0
  • Target file: examples/elfparse
  • libelfmaster commit version: 03b7170

Additional context
ASAN says:

ASAN:DEADLYSIGNAL
=================================================================
==37981==ERROR: AddressSanitizer: SEGV on unknown address 0x7f9e2fbfa000 (pc 0x558fe2223c2c bp 0x7ffd4012e440 sp 0x7ffd4012e420 T0)
==37981==The signal is caused by a READ memory access.
    #0 0x558fe2223c2b in resolve_plt_addr /home/ubuntu/some_c_test/libelfmaster/src/internal.c:1340
    #1 0x558fe22287d6 in reconstruct_elf_sections /home/ubuntu/some_c_test/libelfmaster/src/internal.c:1917
    #2 0x558fe221097a in elf_open_object /home/ubuntu/some_c_test/libelfmaster/src/libelfmaster.c:3237
    #3 0x558fe21ecb04 in main /home/ubuntu/some_c_test/libelfmaster/examples/elfparse.c:38
    #4 0x7f3e27be4c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)
    #5 0x558fe21eec19 in _start (/home/ubuntu/some_c_test/libelfmaster/fuzz/elfparse+0x8c19)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/ubuntu/some_c_test/libelfmaster/src/internal.c:1340 in resolve_plt_addr
==37981==ABORTING

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions