【发布时间】:2017-06-22 13:24:15
【问题描述】:
我应该如何格式化我的输入以在以下代码中返回 libc 攻击:
void example_function(int x, const char *name)
{
void (*foo)(int, const char *) = http_serve_none;
char buf[1024];
sprintf(buf, name);
foo(x, buf);
}
鉴于堆栈是不可执行的。我想通过在 libc 中更改指向系统的 foo 函数指针而不是通过更改 example_function 的返回地址来返回 libc 攻击。到目前为止我所做的是使用常规方法进行输入:
padding + 系统地址(在 foo 函数的地址)+ 的地址 exit + ptr to string ( string = "/bin/sh" )
但这不起作用。我不知道如何在系统调用的输入字符串中格式化我的参数。我在互联网上搜索了很多,但到处都看到只使用返回地址调用 system()。
额外假设:
系统调用地址中没有“0”。机器是 32 位的,并且 sprintf 工作正常,即将名称存储到缓冲区 buf[1024] 中。
【问题讨论】:
-
上课吗?
标签: security buffer-overflow libc exploit shellcode