我正在尝试解决我学校另一个学生提出的这个编程难题,我们得到了一个 .exe 和相应的 .c 源代码。我尝试解决这个问题的方法是使用缓冲区溢出,并且我设法在 Linux 中使用 perl 脚本作为输入来完成此操作,以便我可以输入返回地址的十六进制值。
问题是我们必须使用 Windows 中的 .exe 来完成此操作,并且我不知道如何在命令行中输入十六进制值。对于Linux版本,我使用了这个问题:gdb输入文件中的十六进制值我的代码最终是这样的:
./a.out $(perl -e 'print "A"x34 . "\x7d\x86\x04\x08";')
如何在 Windows 命令行上执行此操作?
I am trying to solve this programming puzzle another student at my school put out, and we were given an .exe and the corresponding .c source code. The way I am trying to attack the problem is with a buffer overflow, and I managed to do it in Linux using a perl script as the input so that I could input the hex values for the return address.
The problem is we have to do it using the .exe in Windows, and I do not know how to enter hex values in the command line. For the Linux version, I used this question: Hex values in gdb input files and my code ending up being this:
./a.out $(perl -e 'print "A"x34 . "\x7d\x86\x04\x08";')
How can I do this on the Windows Command Line?
发布评论
评论(1)
您有一些选择
安装适用于 Windows 的 PERL 或 PYTHON 软件包。然后您可以按照与 Linux 中类似的方式进行操作。
如果您有 powershell,您可以执行以下链接中给出的一些脚本:
http://www.sans.org/windows-security/2010/02/11/powershell-byte-array-hex-convert/
请注意,在编译 Windows 源代码时,栈的结构和EIP的位置都会发生变化。因此,在 Linux 上工作的相同有效负载可能无法工作。
You have some options
Install PERL or PYTHON package for Windows. Then you can do the similar way as you do in Linux.
If you have powershell, you can do some scripting as given in link below:
http://www.sans.org/windows-security/2010/02/11/powershell-byte-array-hex-convert/
Note that when you compile the source code for Windows, there will be change in structure of stack and position of EIP. And hence the same payload might not work which worked on Linux.