小编sto*_*umb的帖子

编写一个返回libc攻击,但libc在内存中加载到0x00

我正在为我的系统安全类编写一个返回libc攻击.首先,易受攻击的代码:

//vuln.c
#include <stdio.h>
#include <stdlib.h>

int loadconfig(void){
  char buf[1024];
  sprintf(buf, "%s/.config", getenv("HOME"));
  return 0;
}

int main(int argc, char **argv){
  loadconfig();
  return 0;
}
Run Code Online (Sandbox Code Playgroud)

我想使用返回libc攻击.编译和调试程序:

$ gcc -g -fno-stack-protector -o vuln vuln.c
$ gdb vuln
(gdb) break loadconfig
(gdb) run
Reached breakpoint blah blah blah.
(gdb) p $ebp
$1 = (void *) 0xbfffefb0
(gdb) p system
$2 = {<text variable, no debug info>} 0x0016db20 <system>
(gdb) p exit
$3 = {<text variable, no debug info>} 0x001639e0 <exit>
(gdb) x/2000s …
Run Code Online (Sandbox Code Playgroud)

c exploit libc buffer-overflow

4
推荐指数
1
解决办法
4305
查看次数

标签 统计

buffer-overflow ×1

c ×1

exploit ×1

libc ×1