Re: [問題] shellcode會core dump
看原PO的想法是想要改 stack 裡的 return address
自己改寫成以下的程式執行無誤(我是64bit,所以用long)
------
#include <stdio.h>
#include <stdlib.h>
void foo2()
{
puts("foo2");
exit(1);
}
void foo1()
{
long *ret;
ret = ((long *)&ret) + 2;
*ret = (long)foo2;
puts("foo1");
}
int main()
{
foo1();
return 0;
}
------
不過將 foo2 改成你的 shellcode 結果就 code dump 了
如果你的shellcode沒錯的話,我猜測的原因是:
http://en.wikipedia.org/wiki/Executable_space_protection
原PO你覺得呢?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.30.141
→
12/30 17:49, , 1F
12/30 17:49, 1F
→
12/30 17:51, , 2F
12/30 17:51, 2F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 2 之 4 篇):