无法执行壳牌code - > (Speicherzugriffsfehler(Speicherabzug geschrieben)) [英] Can't execute Shellcode --> (Speicherzugriffsfehler (Speicherabzug geschrieben))

查看:184
本文介绍了无法执行壳牌code - > (Speicherzugriffsfehler(Speicherabzug geschrieben))的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个功能:

char code[] = "\xeb\x19\x31\xc0\x31\xdb\x31\xd2\x31\xc9\xb0\x04\xb3\x01\x59\xb2\x05\xcd\x80\x31\xc0\xb0\x01\x31\xdb\xcd\x80\xe8\xe2\xff\xff\xff\x68\x65\x6c\x6c\x6f";

int main(int argc, char **argv)
{
  int (*func)();
  func = (int (*)()) code;
  (int)(*func)();
}

(此code是:壳code教程

所以我编译并执行它,但是我只得到这个消息:Speicherzugriffsfehler(Speicherabzug geschrieben)

so i compiled and execute it, but i only get this message: Speicherzugriffsfehler (Speicherabzug geschrieben).

我为什么不拿东西回来,只此错误消息?

Why i don't get something back, only this error message?

P.S:我的系统是一个Ubuntu的x86 PC。外壳code应该使用它。我用gcc和用gcc-4.5编译它,这两个同样的错误...

p.s.: my system is an ubuntu x86 pc. the shellcode should work with it. i compiled it with gcc and with gcc-4.5, both same error...

推荐答案

默认情况下GCC编译应用程序具有不可执行堆栈。你看到的是一个分割的冲突,因为你的筹码被标记为不可执行,但你要在栈上执行code。您可以通过在gdb下运行你的应用程序和检查验证它死了,例如:

By default gcc will compile applications as having nonexecutable stacks. What you're seeing is a segmentation violation because your stack is marked nonexecutable but you're trying to execute code on the stack. You can verify by running your application in gdb and checking where it dies, for instance:

=> 0x601060:JMP 0x60107b

=> 0x601060 : jmp 0x60107b

这是你的shell code的入口点。为了使它所以它不会出现段错误,可以通过执行以下操作禁用exectstack:

This is the entry point of your shellcode. To make it so it doesn't segfault, you can disable exectstack by doing the following:

GCC -z execstack由source.c

gcc -z execstack source.c

这篇关于无法执行壳牌code - > (Speicherzugriffsfehler(Speicherabzug geschrieben))的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆