execv example is segfaulting

Hello I have a problem with the following execv example:

jmp short callit

doit:

pop esi
xor eax, eax
mov byte [esi + 7], al
lea ebx, [esi]
mov long [esi + 8], ebx
mov long [esi + 12], eax
mov byte al, 0x0b
mov ebx, esi
lea ecx, [esi + 8]
lea edx, [esi + 12]
int 0x80

callit: call doit
db '/bin/sh#AAAABBBB'

Why is the code segfaulting? I got it from: http://www.safemode.org/files/zillion/shellcode/doc/Writing_shellcode.html


You have forgotten to tell us how you are running this code and where it faults.

If you tried to put this into a stock executable then it presumably ended up in the read-only text section, hence the fault.

If you tried this from the stack, then that might not be executable, hence the fault.

链接地址: http://www.djcxy.com/p/15900.html

上一篇: 将FindScanline汇编代码转换为purepascal

下一篇: execv示例是segfaulting