我对二元分析很陌生。我试图分析一个简单的程序,我通过gcc从我的C代码编译。
我遵循了以下步骤:
aaaafl我得到了这个输出:
0x00000608 3 23 sym._init
0x00000630 1 8 sym.imp.puts
0x00000638 1 8 sym.imp._IO_getc
0x00000640 1 8 sym.imp.__printf_chk
0x00000648 1 8 sym.imp.__cxa_finalize
0x00000650 4 77 sym.main
0x000006a0 1 43 entry0
0x000006d0 4 50 -> 44 sym.deregister_tm_clones
0x00000710 4 66 -> 57 sym.register_tm_clones
0x00000760 5 50 sym.__do_global_dtors_aux
0x000007a0 4 48 -> 42 sym.frame_dummy
0x000007d0 1 24 sym.smth
0x000007f0 4 101 sym.__libc_csu_init
0x00000860 1 2 sym.__libc_csu_fini
0x00000864 1 9 sym._fini我可以得到main是程序的主要起点,但是我担心entry0是什么。显然我看到的不是一个符号。我试着运行ag @ entry0和ag @ main,我看到的图形非常不同。通过查看已分解的代码,我看到了entry0的如下代码:

我假设这可能是一种ELF模板函数,用于加载二进制文件并从main运行它。entry0到底是什么?
抱歉把它留了这么久。提前谢谢。
发布于 2017-08-09 15:38:36
您应该在https://reverseengineering.stackexchange.com/上发布RE问题。
entry0是_start符号的别名,它对应于_start函数。
_start的内存地址是程序入口点,控制从加载程序传递到程序。_start函数来自一个名为crt1.o的可重定位的ELF对象文件,该文件被链接到需要C运行时环境的二进制文件中。$ objdump -dj .text /usr/lib/x86_64-linux-gnu/crt1.o /usr/lib/x86_64-linux/crt1.o:文件格式elf64-x86-64节.text: 0000000000000000 <_start>:0: 31 ed xor %ebp,%ebp 2: 49 89 d1 mov %rdx,%r9 5: 5e pop %rsi 6: 48 89 e2 mov %rsp,%rdx 9: 48 83 e4 f0和$0 0,%rsp d: 50 push %rax e: 54 push %rsp f: 49 c7 c0 00 00 mov $0 x0,%r8 16: 48 c7 c1 00 00 00 mov $0x0,%rcx 1d: 48 c7 c7 00 00 00 mov $0x0,%rdi 24: e8 00 00 00 callq 29 <_start+0x29> 29: f4 hlt
以/bin/cat为例:
$ readelf -h /bin/cat
ELF Header:
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: Advanced Micro Devices X86-64
Version: 0x1
Entry point address: 0x402602 <-----
Start of program headers: 64 (bytes into file)
Start of section headers: 46112 (bytes into file)
Flags: 0x0
Size of this header: 64 (bytes)
Size of program headers: 56 (bytes)
Number of program headers: 9
Size of section headers: 64 (bytes)
Number of section headers: 28
Section header string table index: 27入口点的内存地址是0x402602。
402602: 31 ed xor %ebp,%ebp
402604: 49 89 d1 mov %rdx,%r9
402607: 5e pop %rsi
402608: 48 89 e2 mov %rsp,%rdx
40260b: 48 83 e4 f0 and $0xfffffffffffffff0,%rsp
40260f: 50 push %rax
402610: 54 push %rsp
402611: 49 c7 c0 60 89 40 00 mov $0x408960,%r8
402618: 48 c7 c1 f0 88 40 00 mov $0x4088f0,%rcx
40261f: 48 c7 c7 40 1a 40 00 mov $0x401a40,%rdi
402626: e8 d5 f1 ff ff callq 401800 <__libc_start_main@plt>
40262b: f4 hlt 建议阅读:
Linux程序启动了,还是--我们怎么才能找到x86 ()呢?
https://stackoverflow.com/questions/45557251
复制相似问题