execve shellcode writing segmentation fault

风格不统一 提交于 2019-11-26 17:58:25

As Bo said in his comment, the .text section is read-only by default on current systems. To make this code work, you have to make it writable. You can for example use a directive in the source file like so:

.section wtext, "awx", @progbits

The equivalent nasm directive is:

section wtext exec write

Alternatively, could also pass the -N switch to the linker.

Note that such shell code is normally intended for stack execution, which is yet another thing that's typically disabled in current operating systems. If you ever want to try this on the stack, you might need the -z execstack linker option.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!