X86 在入口点设置断点失败(GDB)
我目前正在练习REW/GDB,在第一条/第二条指令上停止运行/启动时遇到问题。我是GDB/RE的新手,对GDB的一些内部工作原理知之甚少。到目前为止,当我打开程序时,我已经完成了:X86 在入口点设置断点失败(GDB),x86,gdb,breakpoints,objdump,X86,Gdb,Breakpoints,Objdump,我目前正在练习REW/GDB,在第一条/第二条指令上停止运行/启动时遇到问题。我是GDB/RE的新手,对GDB的一些内部工作原理知之甚少。到目前为止,当我打开程序时,我已经完成了: (gdb) set disassembly-flavor intel (gdb) file /path/to/binary (gdb) info file Symbols from "/path/to/binary".
(gdb) set disassembly-flavor intel
(gdb) file /path/to/binary
(gdb) info file
Symbols from "/path/to/binary".
Local exec file:
`/path/to/binary', file type elf32-i386.
Entry point: 0x8048450
.
.
.
(gdb) b *0x8048450
(gdb) start
Temporary breakpoint 2 at 0x80485f7
Starting program: /path/to/binary
During startup program exited with code 1.
该计划的另一次尝试也产生了以下结果:
(gdb) b *0x8048450
Breakpoint 1 at 0x8048450
(gdb) run
Starting program: /bomb/bomb
During startup program exited with code 1.
因此,显然在入口点设置断点是没有用的。以下是该命令的输出:
objdump /path/to/binary -M intel -D
在前面的内存地址
08048450 <_start>:
8048450: 31 ed xor ebp,ebp
8048452: 5e pop esi
8048453: 89 e1 mov ecx,esp
8048455: 83 e4 f0 and esp,0xfffffff0
8048458: 50 push eax
8048459: 54 push esp
804845a: 52 push edx
804845b: 68 c0 86 04 08 push 0x80486c0
8048460: 68 60 86 04 08 push 0x8048660
8048465: 51 push ecx
8048466: 56 push esi
8048467: 68 e9 85 04 08 push 0x80485e9
804846c: e8 bf ff ff ff call 8048430 <__libc_start_main@plt>
8048471: f4 hlt
8048472: 66 90 xchg ax,ax
8048474: 66 90 xchg ax,ax
8048476: 66 90 xchg ax,ax
8048478: 66 90 xchg ax,ax
804847a: 66 90 xchg ax,ax
804847c: 66 90 xchg ax,ax
804847e: 66 90 xchg ax,ax
08048450:
8048450:31 ed xor ebp,ebp
8048452:5e pop esi
8048453:89 e1 mov ecx,esp
8048455:83 e4 f0和esp,0xfffffff0
8048458:50推式eax
8048459:54推式esp
804845a:52推式edx
804845b:68 c0 86 04 08推送0x80486c0
8048460:68 60 86 04 08推送0x8048660
8048465:51推式ecx
8048466:56推式esi
8048467:68 e9 85 04 08推送0x80485e9
804846c:e8 bf ff ff呼叫8048430
8048471:f4 hlt
8048472:6690xCHGax,ax
8048474:6690xCHGax,ax
8048476:6690xchgax,ax
8048478:6690xchgax,ax
804847a:6690xCHGax,ax
804847c:6690xCHGax,ax
804847e:6690xCHGax,ax
我的总体目标是使用b*Mem,jump*Mem技术跳转到程序中的特定函数,并在该函数中执行代码。但是,为了做到这一点,我相信我需要能够在程序运行时停止程序。您运行的是哪个版本的
gdb
?你在上面尝试过的应该可以很好地工作,对我来说,在GDB7.9.1和一个简单的例子中,它确实可以很好地工作,所以你的案例中有一些特定的东西导致了问题。从gdb初创公司开始:GNU gdb(Ubuntu 7.7.1-0ubuntu5~14.04.2)7.1 OS(lsb_release-a):Ubuntu 14.04.3 ltsm我猜您在测试二进制文件中到达\u start
之前正在退出动态链接器。在启动程序之前,请在gdb提示符下尝试设置环境LD_DEBUG=all,查看输出,它可能会提供一些线索,说明您为什么没有到达二进制文件的入口点。