i am studying shellcode writing. So to spawn a shell i wrote the following program
segment .text
global _start:
_start:
jmp short GotoCall
shellcode:
pop esi
xor eax, eax
mov byte [esi + 7], al #here i get Error
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 80h
GotoCall:
call shellcode
Db '/bin/shJAAAABBBB'
Compiled -> nasm -ggdb -f elf Shellcode_Execve.asm
Linked -> ld -m elf_i386 -ggdb -o Shellcode_Execve Shellcode_Execve.o
When i ran it in GDB, i found in below instruction i get error,
mov byte [esi + 7], al
Can't we write into that memory?
What is the problem in my code?