Can't execute Shellcode --> (Speicherzugriffsfehler (Speicherabzug geschrieben))

前端 未结 2 1346
谎友^
谎友^ 2021-01-07 08:10

i have this function:

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\\x3         


        
2条回答
  •  情歌与酒
    2021-01-07 08:35

    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

    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

提交回复
热议问题