小编Tim*_*ers的帖子

ret2libc 攻击中出现段错误,但未硬编码系统调用

我有以下原恒星挑战

#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>

void getpath()
{
  char buffer[BUFFSIZE];
  char flagBuffer[64];
  FILE *fp;
  unsigned int ret;

  printf("input path please: "); fflush(stdout);

  gets(buffer);

  ret = __builtin_return_address(0);

  if((ret & 0xff000000) == 0xff000000) {
    printf("bzzzt (%p)\n", ret);
    _exit(1);
  }

  printf("got path %s\n", buffer);
}

int main(int argc, char **argv)
{

  getpath();

}
Run Code Online (Sandbox Code Playgroud)

并将其编译为 64 位

gcc stack5.c -DBUFFSIZE=64 -no-pie -fno-stack-protector -O0 -o stack5
Run Code Online (Sandbox Code Playgroud)

我正在使用 pwntools 来制作我的漏洞利用程序。这是我的exploit.py 文件

from pwn import *

exe = './stack5'

context.clear(arch='amd64')
context.kernel = 'amd64' …
Run Code Online (Sandbox Code Playgroud)

c segmentation-fault ctf

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

标签 统计

c ×1

ctf ×1

segmentation-fault ×1